npm: no such file or directory, scandir '.../node_modules/node-sass/vendor'
阿新 • • 發佈:2019-01-07
在啟動vue工程專案時報錯:
npm install
npm run dev
錯誤日誌:
顯示找不到node_modules/node-sass/vendor模組。去資料夾一看,還真的是沒有,應該是在安裝全域性依賴的時候,沒有安裝到vendor,通過rebuild命令重新安裝一下就可以啦。huyikangdeMacBook-Pro:vbap-widgets kangkang$ npm run dev > [email protected] dev /Users/kangkang/vbap-widgets > node build/dev-server.js [HPM] Proxy created: function (path, req) { let match = path.match('^/(me|sec|log|api|query|data|results|table|export|quick|mobile|rules|share|vbap-docs)'); // if (match) { // console.log('proxy path:', path) // } return match } -> http://10.0.2.12:8099/vbap3 [HPM] Subscribed to http-proxy events: [ 'error', 'close' ] > Starting dev server... ERROR Failed to compile with 9 errors 上午9:36:42 error in ./src/theme/index.scss Module build failed: Error: ENOENT: no such file or directory, scandir '/Users/kangkang/vbap-widgets/node_modules/node-sass/vendor' at Object.fs.readdirSync (fs.js:904:18) at Object.getInstalledBinaries (/Users/kangkang/vbap-widgets/node_modules/node-sass/lib/extensions.js:127:13) at foundBinariesList (/Users/kangkang/vbap-widgets/node_modules/node-sass/lib/errors.js:20:15) at foundBinaries (/Users/kangkang/vbap-widgets/node_modules/node-sass/lib/errors.js:15:5) at Object.module.exports.missingBinary (/Users/kangkang/vbap-widgets/node_modules/node-sass/lib/errors.js:45:5) at module.exports (/Users/kangkang/vbap-widgets/node_modules/node-sass/lib/binding.js:15:30) at Object.<anonymous> (/Users/kangkang/vbap-widgets/node_modules/node-sass/lib/index.js:14:35) at Module._compile (module.js:635:30) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3) at Module.require (module.js:579:17) at require (internal/module.js:11:18) at Object.<anonymous> (/Users/kangkang/vbap-widgets/node_modules/sass-loader/lib/loader.js:3:14) at Module._compile (module.js:635:30) @ ./src/theme/index.scss 4:14-145 13:3-17:5 14:22-153 @ ./src/main.js @ multi ./build/dev-client ./src/main.js error in ./src/app/App.vue
解決辦法,執行:npm rebuild node-sass
成功,去資料夾下檢視,確實有了vedor資料夾,再 npm run dev啟動工程就可以啦。huyikangdeMacBook-Pro:vbap-widgets kangkang$ npm rebuild node-sass > [email protected] install /Users/kangkang/vbap-widgets/node_modules/node-sass > node scripts/install.js Downloading binary from https://github.com/sass/node-sass/releases/download/v4.6.1/darwin-x64-57_binding.node Download complete ⸩ ⠋ : Binary saved to /Users/kangkang/vbap-widgets/node_modules/node-sass/vendor/darwin-x64-57/binding.node Caching binary to /Users/kangkang/.npm/node-sass/4.6.1/darwin-x64-57_binding.node >
[email protected] postinstall /Users/kangkang/vbap-widgets/node_modules/node-sass > node scripts/build.js Binary found at /Users/kangkang/vbap-widgets/node_modules/node-sass/vendor/darwin-x64-57/binding.node Testing binary Binary is fine [email protected] /Users/kangkang/vbap-widgets/node_modules/node-sass