sudo npm install webpack -g出错

来源:3-4 npm和webpack的初始化

小米科技whx

2023-01-20

在终端输入sudo npm install webpack -g出错,提示如下:
npm WARN engine webpack@5.75.0: wanted: {“node”:">=10.13.0"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine chrome-trace-event@1.0.3: wanted: {“node”:">=6.0"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine loader-runner@4.3.0: wanted: {“node”:">=6.11.5"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine schema-utils@3.1.1: wanted: {“node”:">= 10.13.0"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine webpack-sources@3.2.3: wanted: {“node”:">=10.13.0"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine tapable@2.2.1: wanted: {“node”:">=6"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine enhanced-resolve@5.12.0: wanted: {“node”:">=10.13.0"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine watchpack@2.4.0: wanted: {“node”:">=10.13.0"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine terser-webpack-plugin@5.3.6: wanted: {“node”:">= 10.13.0"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine browserslist@4.21.4: wanted: {“node”:"^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine eslint-scope@5.1.1: wanted: {“node”:">=8.0.0"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine jest-worker@27.5.1: wanted: {“node”:">= 10.13.0"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine terser@5.16.1: wanted: {“node”:">=10"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine escalade@3.1.1: wanted: {“node”:">=6"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine @jridgewell/resolve-uri@3.1.0: wanted: {“node”:">=6.0.0"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine supports-color@8.1.1: wanted: {“node”:">=10"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine punycode@2.3.0: wanted: {“node”:">=6"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine @jridgewell/gen-mapping@0.3.2: wanted: {“node”:">=6.0.0"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine has-flag@4.0.0: wanted: {“node”:">=8"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm WARN engine @jridgewell/set-array@1.1.2: wanted: {“node”:">=6.0.0"} (current: {“node”:“4.4.7”,“npm”:“2.15.8”})
npm ERR! Darwin 22.2.0
npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install” “webpack” "-g"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! path /usr/local/lib/node_modules/webpack/node_modules/@types/eslint-scope/package.json
npm ERR! code ENOTDIR
npm ERR! errno -20
npm ERR! syscall open

npm ERR! ENOTDIR: not a directory, open '/usr/local/lib/node_modules/webpack/node_modules/@types/eslint-scope/package.json’
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /Users/wanghongxin/norest365-fe/doc/norest365-fe/npm-debug.log

写回答

1回答

Rosen

2023-02-10

卸载了,然后加上版本号进行安装,npm install webpack@1.15.0 -g

0
2
Rosen
回复
小米科技whx
遇到问题了多翻一下问答区,一般的坑之前的同学都应该踩过了。
2023-02-12
共2条回复

真实数据对接 从0开发前后端分离的企业级上线项目

【毕设项目精品】前端实战,对接真实服务端数据,开发完整项目

4262 学习 · 4113 问题

查看课程