Can't run "npm install" without deleting node_modules after upgrading to NPM 5.4.1

3.2k Views Asked by At

I've upgraded NPM from 5.3.0 to 5.4.1 and after that, it seems that the command npm install works only if I've removed node_modules. When I try to rerun the installation, I'm getting the following error message. (After that, if I again remove node_modules, the command run install works - once.)

PS C:\source\website> npm install
npm ERR! path C:\source\website\node_modules\fsevents\node_modules\aproba\package.jsonvet.Web
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\source\website\node_modules\fsevents\node_modules\aproba\package.json'
npm ERR! {
Error: EPERM: operation not permitted, unlink 'C:\source\website\node_modules\fsevents\node_modules\aproba\package.json'
npm ERR! stack: 'Error: EPERM: operation not permitted, unlink \'C:\source\website\node_modules\fsevents\node_modules\aproba\package.json\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
'C:\source\website\node_modules\fsevents\node_modules\aproba\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\butt\AppData\Roaming\npm-cache_logs\2017-09-13T16_42_26_030Z-debug.log
PS C:\source\website>

Nothing else has changed in my setup, as far I'm aware. My environment is Windows 10 and Node 8.2.1. The behavior seems to be consistent on several computers.

I notice that during the re-runs of the installation, there's a lot of waiting time, like if the installer gets stuck, on the following stage of it.

added 995 packages in 29.671s
PS C:\source\website> npm install
[ ......] - postinstall: sill doSerial postinstall 686

I have no clue on how to proceed with this. Is fsevents to blame at all? I recall that it produced warnings but still transpiling fine in earlier versions.

There's a related question on this theme but precisely covering my issue. I can't decide if it's just different working of the same problem or if it's two separate troubles.

3

There are 3 best solutions below

0
On BEST ANSWER

I'm running Win 10 and recognized the same issue. The resolution was to downgrade to 5.3. I also noticed that 5.4.0 worked on our build server (TFS 2017).

npm install --global [email protected]

One thing that provided no help at all was all the stuff about admin mode. We lost a few hours reconfiguring and resetting the build pipe using admin rights.

There was a crucial module that required 5.4.1 for some reason, not relevant which in this particular case. We resolved it by separate steps in the pipe - one that reused a pre-built version and one that was dynamically assembled.

Also, I'd not worry about it. In a few days or so, there's got to be an update and the issue will be resolved. Until then - downgrade to 5.3 is the hack-around we used.

0
On

This is a common issue many found with npm 5.4 , only option at this point is to downgrade npm back to 5.3

npm i -g [email protected]

For more updates follow this thread.

https://github.com/npm/npm/issues/18380

P.S : you can also try using npm cache clean --force after the downgrade and try installing 5.4 again with npm i -g [email protected] or npm install --no-optional if you really need npm 5.4 to get your work done.

0
On

Dont' know what is causing issue but you can try several solutions that worked for others :

  • 1

    npm cache clean

    npm install

  • 2

    npm i

  • 3

    Run your command prompt by right clicking as choose open as administrator and then run your command

Hope this help you.