在centos7下执行 npm install 和 npm install webpack --save-dev 都报了如下错,很郁闷,搞了好久。
npm WARN [email protected] requires a peer of [email protected]>=5.0.0 but none is
installed. You must install peer dependencies yourself.npm ERR! code ENOENT npm ERR! syscall access npm ERR! path
/yonyou/uat-workspace/occ-project/hhocc/occ-portal-static/node_modules/[email protected]@accepts/node_modules/mime-types
npm ERR! errno -2 npm ERR! enoent ENOENT: no such file or directory,
access
‘/yonyou/uat-workspace/occ-project/hhocc/occ-portal-static/node_modules/[email protected]@accepts/node_modules/mime-types’
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoentnpm ERR! A complete log of this run can be found in: npm ERR!
/root/.npm/_logs/2020-04-15T03_37_37_044Z-debug.log
[[email protected] occ-portal-static]# npm run webpack npm ERR!
missing script: webpacknpm ERR! A complete log of this run can be found in: npm ERR!
/root/.npm/_logs/2020-04-15T03_38_08_854Z-debug.log
最终解决是使用 rm -rf 命令 删除项目下的 node_modules 文件
即:rm -rf node_modules/
如图:
再执行: npm install webpack --save-dev
,如图:
执行成功后再执行:npm install
,如图: