在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! enoent

npm 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: webpack

npm 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 或 npm install webpack --save-dev 报错
再执行: npm install webpack --save-dev,如图:
npm install 或 npm install webpack --save-dev 报错

执行成功后再执行:npm install,如图:
npm install 或 npm install webpack --save-dev 报错

相关文章:

  • 2021-08-30
  • 2021-09-29
  • 2020-02-03
  • 2021-08-23
  • 2018-05-05
  • 2021-11-07
  • 2021-08-30
  • 2021-08-13
猜你喜欢
  • 2017-11-27
  • 2019-10-28
  • 2017-11-25
  • 2021-10-16
  • 2020-01-10
  • 2019-07-26
  • 2021-11-17
  • 2021-11-17
相关资源
相似解决方案