Griseld Gerveni
Griseld Gerveni

Reputation: 482

npm install -g expo-cli fails with "EPERM: operation not permitted, unlink '...\adb.exe'

I receive an error when running

$ npm install -g expo-cli

I have tried reinstalling the node modules as An Administrator but the same error occurs.

Environment: Windows 10, Node Version: 10.15.3, NPM Version: 6.9.0

I expect the install to happen but an error like this occurs:

npm ERR! path C:\Users\Griseld\AppData\Roaming\npm\node_modules\expo-cli\node_modules.xdl.DELETE\binaries\windows\adb\adb.exe npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall unlink npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Griseld\AppData\Roaming\npm\node_modules\expo-cli\node_modules.xdl.DELETE\binaries\windows\adb\adb.exe' npm ERR! { [Error: EPERM: operation not permitted, unlink 'C:\Users\Griseld\AppData\Roaming\npm\node_modules\expo-cli\node_modules.xdl.DELETE\binaries\windows\adb\adb.exe'] npm ERR! cause: npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\Griseld\AppData\Roaming\npm\node_modules\expo-cli\node_modules.xdl.DELETE\binaries\windows\adb\adb.exe' npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR!
syscall: 'unlink', npm ERR! path: npm ERR!
'C:\Users\Griseld\AppData\Roaming\npm\node_modules\expo-cli\node_modules\.xdl.DELETE\binaries\windows\adb\adb.exe' }, npm ERR! stack: npm ERR! 'Error: EPERM: operation not permitted, unlink \'C:\Users\Griseld\AppData\Roaming\npm\node_modules\expo-cli\node_modules\.xdl.DELETE\binaries\windows\adb\adb.exe\'', npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'unlink', npm ERR! path: npm ERR!
'C:\Users\Griseld\AppData\Roaming\npm\node_modules\expo-cli\node_modules\.xdl.DELETE\binaries\windows\adb\adb.exe', 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).

Upvotes: 14

Views: 11324

Answers (7)

Amit Sharma
Amit Sharma

Reputation: 1795

Here are the steps

  1. Open Task Manager - right-click on the task bar and select it, or from the screen when you Ctrl-Alt-Delete. If you have the standard Task Manager, click to expand More details. (If you're using something like Process Explorer, you're probably comfortable finding your own way.)

  2. In the Background processes click on adb.exe (32 bit) (or, presumably, something similar). Click End task or press Delete to kill the process. This should unlock the problematic files.

  3. This is probably not necessary - I deleted the folder that contained the files that caused the error in the first place, .xdl-DELETE. (I would expect npm to do it for me but I was testing my hypothesis 😉.) Remember to close any command prompts or Explorer windows afterwards, because otherwise you'll be locking the expo-cli folder. (I'd left an Explorer window open in that folder which is why I mention it 🤦‍♂️.)

  4. Run npm i -g expo-cli to update. You'll have time to make a cup of tea while it's going, so I suggest doing that.

Upvotes: 0

BenCooper01
BenCooper01

Reputation: 21

Simply deleting "android/app/build" fixed it for me.

Upvotes: 0

sami ullah
sami ullah

Reputation: 1094

The steps I followed (May this follow help you.)

  1. npm uninstall -g expo-cli (If already have installed any version on your machine)
  2. npm clear cache --force
  3. Killed Abd.exe from Task Manager
  4. npm uninstall -g expo-cli

It worked for me, good luck.

Upvotes: 2

Vinoth Smart
Vinoth Smart

Reputation: 393

More Simple Solution For Windows 10 Close The Android Emulator.

And restart the system and run npm install -g expo-cli

Upvotes: 2

Baraja Swargiary
Baraja Swargiary

Reputation: 459

In my case, stopping the webpack server did the job.

Upvotes: 0

Subhojit Ghosh
Subhojit Ghosh

Reputation: 287

Go to your task manager and kill the process of Adb.exe and boom.

Upvotes: 3

Frankrnz
Frankrnz

Reputation: 694

Go through this line from your error log, it says 'C:\Users\Griseld\AppData\Roaming\npm\node_modules\expo-cli\node_modules.xdl.DELETE\binaries\windows\adb\adb.exe' npm ERR!

the expo cli wasn't installing simply because your adb is still using the previously installed expo cli on your system. had similar issue not quite long...kill the process adb.exe

Upvotes: 52

Related Questions