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能夠選擇不須要,由於它是檢驗的,能夠不用,若是用它格式寫的不規範啓不來頁面狀況十二: 解決方案:
相關文章
相關標籤/搜索