vue:报错集锦

311 阅读1分钟

2021.08.05

报错信息:
TypeError: Cannot read properties of undefined (reading 'upgrade')

创建项目后,配置vue.config.js后启动报错,出现这种情况是因为vue.config.js中devServer设置了proxy,但target为空,将target设置一个地址即可。

报错信息:
Syntax Error: SassError: File to import not found or unreadable: ~@assets/style/variables.scss.
        on line 1 of /Users/jing/vue-template-ms/src/desktop/index.vue

官网配置 cli.vuejs.org/zh/guide/cs…

报错信息:
vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in render: "RangeError: Maximum call stack size exceeded"
启动工程白屏报错:
 [vue-router] route config "component" for path: /task cannot be a string id. Use an actual component instead.

2019.02.20

执行npm install命令报错

npm ERR! Unexpected end of JSON input while parsing near '...W8fEqHTa/\n3Ur48g5W00'

先清除缓存,再重新安装

npm cache clean --force
npm install

ESLint运行报错

Missing space before function parentheses    space-before-function-paren
 Missing space before opening brace           space-before-blocks
Missing space before function parentheses    space-before-function-paren
A space is required after '{'                object-curly-spacing
Extra space after key 'color'                key-spacing
Unnecessarily quoted property 'color' found  quote-props
A space is required before '}'               object-curly-spacing
Missing space before function parentheses    space-before-function-paren
Missing semicolon                            semi

安装element-ui 报错

npm 安装element-ui

npm i element-ui -S

运行时找不到node-sass模块报错

Error: Cannot find module 'node-sass'

是因为你没安装node-sass模块或者安装时用的cnpm而不是npm,导致版本过低。可以通过npm install node-sass 进行单独安装或是删除项目文件夹下的node_modules文件夹,执行npm install命令,重新安装包。

运行electron报错

    throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')   

npm install --save-dev electron