一、问题描述:vue启动 npm run dev 报错 Error: Cannot find module webpack

bogon:marking-vue bc$ sudo npm run dev
Password:

> iview-project@2.0.0 dev /Users/bc/xx/marking-vue
> webpack-dev-server --content-base ./ --open --inline --hot --compress --history-api-fallback --config webpack.dev.config.js

sh: /Users/bc/xx/marking-vue/node_modules/.bin/webpack-dev-server: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! iview-project@2.0.0 dev: `webpack-dev-server --content-base ./ --open --inline --hot --compress --history-api-fallback --config webpack.dev.config.js`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the iview-project@2.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bc/.npm/_logs/2020-03-27T07_56_03_341Z-debug.log

二、原因:没有安装webpack-cli

三、解决办法:安装

npm install --save-dev webpack
npm install --save-dev webpack-cli
Logo

前往低代码交流专区

更多推荐