vue 常見報錯問題


情況一:http://eslint.org/docs/rules/no-tabs  Unexpected tab character

解決方案:縮進是4個空格,而不是tab,設置indent

情況二 : $ npm run dev 運行報錯 

 解決方案:該問題是因為腳手架工具默認監聽的是8080端口,此時是8080端口被占用情況導致的。

A.找出8080端口占用進程然后殺死

執行 $ lsof -i :8080

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

執行sudo kill -9 79 

再執行 npm run dev,然后搭建成功.

B.修改config 配置

情況三: 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種方法:

1、命令行安裝:

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

2、直接編輯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 的配置 

module.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"] } };

情況十: Media query expression must begin with '('

解決方案:

情況十一:
vue報錯cannot GET
解決方案:  你init vue-cli的時候,有個選項問你是否需要eslint可以選擇不需要,因為它是檢驗的,可以不用,如果用它格式寫的不規范啟不來頁面

情況十二:

解決方案:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM