在启动vue工程项目时报错:
npm install
npm run dev
错误日志:
huyikangdeMacBook-Pro:vbap-widgets kangkang$ npm run dev
> vbap-widgets@3.0.6-SNAPSHOT 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
显示找不到node_modules/node-sass/vendor模块。去文件夹一看,还真的是没有,应该是在安装全局依赖的时候,没有安装到vendor,通过rebuild命令重新安装一下就可以啦。
解决办法,运行:npm rebuild node-sass
huyikangdeMacBook-Pro:vbap-widgets kangkang$ npm rebuild node-sass
> node-sass@4.6.1 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
> node-sass@4.6.1 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
node-sass@4.6.1 /Users/kangkang/vbap-widgets/node_modules/node-sass
成功,去文件夹下查看,确实有了vedor文件夹,再 npm run dev启动工程就可以啦。
---------------------
原文:https://blog.csdn.net/u010429286/article/details/78651917
网友评论