在SVN上拉下來一個vue項目,上面沒有提交項目里面的node_modules文件夾,所以要自己執行 npm install 安裝,但安裝完后運行項目后卻報錯了:
$ npm run dev > poverty@1.0.0 dev F:\05 poverty alleviation project\poverty-git > webpack-dev-server --inline --progress --config build/webpack.dev.conf.js 。。。。。此處省略加載的進度。。。。。
94% asset optimization ERROR Failed to compile with 7 errors15:16:02
//中間部分都是同下面的一種錯誤
error in ./src/assets/css/home/dataProfile.scss Module build failed: Error: ENOENT: no such file or directory, scandir 'F:\05 poverty alleviation project\poverty-git\node_modules\node-sass\vendor' at Object.fs.readdirSync (fs.js:904:18) at Object.getInstalledBinaries (F:\05 poverty alleviation project\poverty-git\node_modules\node-sass\lib\extensions.js:129:13) at foundBinariesList (F:\05 poverty alleviation project\poverty-git\node_modules\node-sass\lib\errors.js:20:15) at foundBinaries (F:\05 poverty alleviation project\poverty-git\node_modules\node-sass\lib\errors.js:15:5) at Object.module.exports.missingBinary (F:\05 poverty alleviation project\poverty-git\node_modules\node-sass\lib\errors.js:45:5) at module.exports (F:\05 poverty alleviation project\poverty-git\node_modules\node-sass\lib\binding.js:15:30) at Object.<anonymous> (F:\05 poverty alleviation project\poverty-git\node_modules\node-sass\lib\index.js:14:35) at Module._compile (module.js:643:30) at Object.Module._extensions..js (module.js:654:10) at Module.load (module.js:556:32) at tryModuleLoad (module.js:499:12) at Function.Module._load (module.js:491:3) at Module.require (module.js:587:17) at require (internal/module.js:11:18) at Object.sassLoader (F:\05 poverty alleviation project\poverty-git\node_modules\sass-loader\lib\loader.js:24:22) @ ./src/assets/css/home/dataProfile.scss 4:14-222 13:3-17:5 14:22-230 @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/iview-loader??ref--0-1!./src/pages/home/dataProfile.vue @ ./src/pages/home/dataProfile.vue @ ./src/router/routers.js @ ./src/router/index.js @ ./src/main.js @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
考慮是沒有把需要的插件或者包都安裝下來,所以就重新執行了一次 npm install ,然后根據報錯信息,重新安裝ajv(沒見過這玩意,這個是什么呢?)
$ npm install
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
audited 33495 packages in 10.919s
found 16 vulnerabilities (1 low, 10 moderate, 4 high, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
$ npm install ajv@^6.0.0
+ ajv@6.5.2
added 6 packages from 1 contributor, updated 3 packages and audited 33501 packages in 14.673s
found 16 vulnerabilities (1 low, 10 moderate, 4 high, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
然后下一步重新執行 npm run dev 就可以運行代碼了。