expo: i get this massive error when i try to install expo, npm installs successfully

C:\Users\Chawki>npm install expo-cli --global

`npm ERR! path C:\Users\Chawki\AppData\Roaming\npm\node_modules\expo-cli\node_modules.xdl.DELETE\binaries\windows\adb\AdbWinUsbApi.dll npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall unlink npm ERR! Error: EPERM: operation not permitted, unlink ‘C:\Users\Chawki\AppData\Roaming\npm\node_modules\expo-cli\node_modules.xdl.DELETE\binaries\windows\adb\AdbWinUsbApi.dll’ npm ERR! { [Error: EPERM: operation not permitted, unlink ‘C:\Users\Chawki\AppData\Roaming\npm\node_modules\expo-cli\node_modules.xdl.DELETE\binaries\windows\adb\AdbWinUsbApi.dll’] npm ERR! cause: npm ERR! { Error: EPERM: operation not permitted, unlink ‘C:\Users\Chawki\AppData\Roaming\npm\node_modules\expo-cli\node_modules.xdl.DELETE\binaries\windows\adb\AdbWinUsbApi.dll’ npm ERR! errno: -4048, npm ERR! code: ‘EPERM’, npm ERR! syscall: ‘unlink’, npm ERR! path: npm ERR! ‘C:\Users\Chawki\AppData\Roaming\npm\node_modules\expo-cli\node_modules\.xdl.DELETE\binaries\windows\adb\AdbWinUsbApi.dll’ }, npm ERR! stack: npm ERR! ‘Error: EPERM: operation not permitted, unlink 'C:\Users\Chawki\AppData\Roaming\npm\node_modules\expo-cli\node_modules\.xdl.DELETE\binaries\windows\adb\AdbWinUsbApi.dll'’, npm ERR! errno: -4048, npm ERR! code: ‘EPERM’, npm ERR! syscall: ‘unlink’, npm ERR! path: npm ERR! ‘C:\Users\Chawki\AppData\Roaming\npm\node_modules\expo-cli\node_modules\.xdl.DELETE\binaries\windows\adb\AdbWinUsbApi.dll’, npm ERR! parent: ‘expo-cli’ } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It’s possible that the file was already in use (by a text editor or antivirus), npm ERR! or that you lack permissions to access it. npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Chawki\AppData\Roaming\npm-cache_logs\2018-11-29T05_34_05_913Z-debug.log`

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 43 (5 by maintainers)

Most upvoted comments

restarting the pc fix this

npm login fixed this error for me, albeit at the expense of making me feel a bit silly.

If you don’t want to restart, kill the process adb.exe

Restarting didn’t work for me

Seems to be an NPM issue. The following worked for me:

  1. npm cache clean --force
  2. npm install -g npm@latest --force
  3. npm cache clean --force

If you get a ‘Metro Bundler process exited with code 1’ afterwards, change file \node_modules\metro-config\src\defaults\blacklist.js to:

var sharedBlacklist = [ /node_modules[/\]react[/\]dist[/\]./, /website/node_modules/./, /heapCapture/bundle.js/, /./tests/./ ];

npm login

This worked for me straight up…thank you!

I already tried almost all solutions in internet and nothing worked. Someone have more tips on this error ? I’m using windows 10 64-bit. Already tried restarting, clean cache, change properties of the folder, downgrading version, npm login and another things … I think I already tried everything… someone knows what’s this error ?

same here when i try to install any package globally in my windows 7 32bits setup.

In case i forget something:

turn off firewall (i don’t use antivirus since 2010 or so) change properties of the folder deleting npm and npm cache folder run cmd.exe as administrator npm cache clean -f npm login npm i -g package

No matter what, i get this massive error prompt with the silly “the operation was rejected by your operating system.” message.

switch between nodejs/npm versions doesn’t change anything (i tried with 10 different versions). I also thought it was something related with my windows so i installed ubuntu and surprise, i had the exact same error prompt.

The cool thing is that apparently on unix based system you can bypass this issue executing your command’s as superuser (i have tried on ubuntu, openbsd, and arch so far). I think windows have a similar command named runas but i barely use those and can’t get it work.

To solve the problem, I had to migrate to WSL (solved this one but got other errors related to network), and finally I made dual boot on my pc and started to use Ubuntu 18.04 LTS. I didn’t have the error anymore. Couldn’t solve the problem on windows 10 though.

npm login worked !!! YAY

npm login worked !!! YAY

go to npm, make an account. And then use command: npm login before npm install. It worked finally!!

npm login

This worked for me straight up…thank you!

Yes it worked for me too… Thanks

From this morning I have tried all the solution available on the internet.None of them worked for me Npm cache clean/New installation/Restart/install the new version/old version/Npm login etc. After trying numerous time with all the possible solution,I read the errors carefully to find out what is really going on.I find out (“If you believe this might be a permissions issue”) that I should use run as administrator.

(Visitor like me) If you are fetching this problem Try to run

->run cmd.exe as administrator ->then Run npm command In my case : ->run cmd.exe as administrator ->npm install -g json-sever And its worked for me.I hope It will also work for you.

Restart PC it works fine. I got the same issue

someone solved ? how ? @clabough

try restarting your pc

The problem may have to do with file locking. Restarting cleared the file lock. I was getting this error on a different command, then did an iisreset on my machine and the error message went away.

I have to thank @Chawki726, I had the same error and restarting PC does indeed solve the problem immediately. I’ve tried bunch of other things before restarting and nothing else worked (trying to run the command as admin, deleting the files manually, etc…)