vue 常见报错问题

状况一:http://eslint.org/docs/rules/no-tabs  Unexpected tab charactervue

解决方案:缩进是4个空格,而不是tab,设置indentjava

状况二 : $ npm run dev 运行报错 node

 解决方案:该问题是由于脚手架工具默认监听的是8080端口,此时是8080端口被占用状况致使的。vue-router

A.找出8080端口占用进程而后杀死chrome

执行 $ lsof -i :8080vue-cli

COMMAND PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
httpd    79  root    6u  IPv6 0x16935b8002e27567      0t0  TCP *:http-alt (LISTEN)express

执行sudo kill -9 79 npm

再执行 npm run dev,而后搭建成功.windows

B.修改config 配置sass

状况三: http://eslint.org/docs/rules/eol-last Newline required at end of file but not found

解决方案:结尾 须要空一行

状况四: http://eslint.org/docs/rules/no-tabs  Unexpected tab character

解决方案: 删除行前空格

状况五: Uncaught TypeError: router.map is not a function

解决方案: vue router 2.0 没有map这个方法了,直接在new router的时候传入

      npm install vue-router@0.7.13 兼容1.0版本vue

状况六: $ npm install node-sass --save-dev 失败

解决方案: $ npm install node-sass --registry=http://registry.npm.taobao.org

 

设置镜像的2种方法:

一、命令行安装:

npm config set registry http://registry.cnpmjs.org
npm info underscore 

二、直接编辑node安装目录下的npmrc文件,个人文件路径在:C:\Program Files (x86)\nodejs\node_modules\npm

用记事本打开,在最后添加一行:registry = http://registry.cnpmjs.org

状况七: Failed at the chromedriver@2.27.3 install script 'node install.js'.

解决方案: $ npm install chromedriver -g

状况八: Failed at the phantomjs-prebuilt@2.1.14 install script 'node install.js

解决方案: npm install phantomjs-prebuilt@2.1.14 --ignore-scripts

状况九: http://eslint.org/docs/rules/linebreak-style  Expected linebreaks to be 'LF' but found 'CRLF'

解决方案:方案1. /*eslint linebreak-style: ["error", "windows"]*/

     方案2. 修改根路径下 .eslintrc.js 的配置 



状况十: Media query expression must begin with '('

解决方案:

状况十一:
vue报错cannot GETmodule.exports = { "root": true, "parserOptions": { "sourceType": "module", "ecmaVersion": 6 }, "rules": { // windows linebreaks when not in production environment "linebreak-style": ["error", process.env.NODE_ENV === 'prod' ? "unix" : "windows"] } };
解决方案:  你init vue-cli的时候,有个选项问你是否须要eslint能够选择不须要,由于它是检验的,能够不用,若是用它格式写的不规范启不来页面状况十二: 解决方案:
相关文章
相关标签/搜索