Module Error (from ./node_modules/eslint-loader/index.js):解決辦法
vue啟動項目報如下錯誤:
E:\workVue\vue-gdonlinepay-h5\src\views\payConfirm\index.vue 105:19 error Missing space before opening brace space-before-blocks 106:7 error Expected space(s) after "if" keyword-spacing 106:22 error Missing space before opening brace space-before-blocks
當vue渲染html為原生標簽時出這個錯誤,需要修改配置項。
優化如下:
第一步:初始化并重新安裝eslint
npm init -y
npm install eslint --save-dev
第二步:進入node_modules下的bin目錄,并初始化eslint
cd ./node_modules/.bin/
.\eslint --init
第三步:設置配置選項,除選擇vue.js外,其他都選擇默認項或者y或者Y,如下僅僅到選擇vue.js步驟
? How would you like to use ESLint? To check syntax and find problems
? What type of modules does your project use? JavaScript modules (import/export)
? Which framework does your project use? Vue.js
? Does your project use TypeScript? No
? Where does your code run? Browser
? What format do you want your config file to be in? JavaScript
第四步:最重要的一步,將node_modules目錄下的bin目錄里面的.eslintrc.js文件拷貝到項目根目錄下
第五步:啟動服務
npm run serve
結束!