Madtin
Madtin

Reputation: 109

Cannot install Webpack with NPM

npm install --save-dev webpack gives me the following error:

$ npm install --save-dev webpack

> [email protected] 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

It doesn't get added to package.json either

Can anyone help me please? I've reinstalled latest stable node version but still doesn't work.

Upvotes: 4

Views: 4854

Answers (2)

Krishnaveni
Krishnaveni

Reputation: 1

Close IDE and then try. It works for me

Upvotes: -1

Jeff Wilcox
Jeff Wilcox

Reputation: 6385

Consider trying npm install --no-optional webpack --save-dev.

At least with Node 8.4 + npm 5.4.0 this helped me work around this today.

Upvotes: 6

Related Questions