Refusing to delete D:\node.js\node_global\node_modules\webpack\node_modules.bin\acorn.cmd: is outside D:\node.js\node_global\node_modules\webpack\node_modules\acorn and not a link
等等类似的错误无法删除错误,请查看你的node.js里面的是否有关webpack残留文件(报错中会有显示路径),可以先进行复制后(防止万一无法解决好恢复),直接删除后,从新输入npm install webpack@3.6.0 -g
我的cmd的错误结果
C:\WINDOWS\system32>npm install webpack@3.6.0 -g
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\webpack\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! path D:\node.js\node_global\node_modules\webpack\node_modules\.bin\mkdirp.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete D:\node.js\node_global\node_modules\webpack\node_modules\.bin\mkdirp.cmd: is outside D:\node.js\node_global\node_modules\webpack\node_modules\mkdirp and not a link
npm ERR! File exists: D:\node.js\node_global\node_modules\webpack\node_modules\.bin\mkdirp.cmd
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\node.js\node_cache\_logs\2020-02-28T15_04_55_339Z-debug.log