Ionic-cli: Error: EPERM: operation not permitted, unlink 'C:\Users\hp\AppData\Roaming\npm\node_modules.staging'

Created on 20 Sep 2016  路  6Comments  路  Source: ionic-team/ionic-cli

_From @jyoti507caroldata on September 20, 2016 8:9_

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "ionic"
npm ERR! node v6.6.0
npm ERR! npm v3.10.3
npm ERR! path C:\Users\hp\AppData\Roaming\npm\node_modules.staging
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink

npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\hp\AppData\Roaming\npm\node_modules.staging'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\hp\AppData\Roaming\npm\node_modules.staging'
npm ERR! at Error (native)
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\Users\hp\AppData\Roaming\npm\node_modules.staging' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\hp\npm-debug.log

_Copied from original issue: driftyco/ionic#8136_

Most helpful comment

It took me quite a long time to find out that it may happen you are trying to install/uninstall any package that depends on Ionic, and Ionic is running.

All 6 comments

_From @kelvindart on September 20, 2016 8:54_

Are you running cmd as Administrator? If not, you probably should be. Right-click cmd > Run as administrator:

run as admin dialog

_From @jyoti507caroldata on September 20, 2016 10:19_

i try this bt same problem create

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "cordova"
npm ERR! node v6.6.0
npm ERR! npm v3.10.3
npm ERR! path C:\Users\hp\AppData\Roaming\npm\node_modules.staging
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink

npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\hp\AppData\Roaming\npm\node_modules.staging'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\hp\AppData\Roaming\npm\node_modules.staging'
npm ERR! at Error (native)
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\Users\hp\AppData\Roaming\npm\node_modules.staging' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR! C:\WINDOWS\system32\npm-debug.log

_From @brandyscarney on September 20, 2016 15:49_

Can you try uninstalling ionic and reinstalling it?

npm uninstall -g ionic
npm install -g ionic

I was getting this same message trying to install ionic-cli myself this morning (Windows 10 x64).. I didn't think to check what version I already had, but the command npm i -g ionic spat out the same error as seen in this issue.

I must say, I did already have 3.19.0 installed, not sure if that has anything to do with this... To be safe, I tried removing and reinstalling it, which ran through without any issues:

D:\>npm un -g ionic
removed 250 packages in 5.323s

D:\>npm i -g ionic
C:\nodejs\ionic -> C:\nodejs\node_modules\ionic\bin\ionic
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\ionic\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (curr
ent: {"os":"win32","arch":"x64"})

+ [email protected]
added 366 packages in 57.359s

Another interesting point to keep in mind here: I run my NodeJS environments using nvm-windows. This means my C:\nodejs folder is actually symbolic link, as per the following line from dir:

2017-11-09  09:23    <SYMLINKD>     nodejs [C:\Users\agreeff\AppData\Roaming\nvm\v6.12.0]

@ZaLiTHkA Thanks for providing some insight into this issue. I hope others who find this can fix it in the same way.

This looks to be a glitch/hiccup issue with npm on Windows. If frequency increases, I will look into it with npm.

It took me quite a long time to find out that it may happen you are trying to install/uninstall any package that depends on Ionic, and Ionic is running.

Was this page helpful?
0 / 5 - 0 ratings