【发布时间】:2018-02-19 19:15:24
【问题描述】:
npm install --save-dev webpack 给我以下错误:
$ npm install --save-dev webpack
> uglifyjs-webpack-plugin@0.4.6 postinstall C:\Users\Martin\Desktop\JS\React\Mi-config\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js
npm ERR! path C:\Users\Martin\Desktop\JS\React\Mi-config\node_modules\fsevents\node_modules\ansi-regex\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Martin\Desktop\JS\React\Mi-config\node_modules\fsevents\node_modules\ansi-regex\package.json'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\Martin\Desktop\JS\React\Mi-config\node_modules\fsevents\node_modules\ansi-regex\package.json'
npm ERR! at Error (native)
npm ERR! stack: 'Error: EPERM: operation not permitted, unlink \'C:\\Users\\Martin\\Desktop\\JS\\React\\Mi-config\\node_modules\\fsevents\\node_modules\\ansi-regex\
\package.json\'\n at Error (native)',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\Martin\\Desktop\\JS\\React\\Mi-config\\node_modules\\fsevents\\node_modules\\ansi-regex\\package.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Martin\AppData\Roaming\npm-cache\_logs\2017-09-11T13_53_27_111Z-debug.log
它也不会被添加到 package.json 中
谁能帮帮我?我已经重新安装了最新的稳定节点版本,但仍然无法使用。
【问题讨论】:
-
当我的 IDE 打开项目文件夹时我遇到了这个问题(锁定了一些库以解析它们以用于 IntelliSensE)。尝试关闭所有内容并重试 npm 安装。
-
刚刚尝试关闭我的 IDE (WebStorm) 仍然给我同样的错误:/ 谢谢你
-
这种情况也有时会发生在我身上。我在 npm 5.4.1 上,有时只是
rm -rf node_modules然后安装帮助。这有点像大锤,但对我有用。 -
也不行,我快疯了T_T
-
我今天在 Windows 上看到了同样的错误。 :/ 回到我的 Mac!