Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

adb.exe is left running in the background (npm install -g expo-cli fails with "EPERM: operation not permitted, unlink '...\adb.exe') #283

Closed
cory-baker opened this issue Dec 30, 2018 · 8 comments · Fixed by #1876
Assignees
Labels
bug Something isn't working

Comments

@cory-baker
Copy link

Description

I receive an error when running npm install -g expo-cli

Expected Behavior

For there not to be an error

Observed Behavior

npm ERR! path C:\Users\Cory\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\Cory\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\Cory\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\Cory\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\\Cory\\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\\Cory\\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\\Cory\\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).

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Cory\AppData\Roaming\npm-cache\_logs\2018-12-30T20_05_51_538Z-debug.log

Environment

cant run because expo-cli will not install

@S00161418
Copy link

I am getting the same error. I tried updating node and npm and then running as administrator but the error still appears.

@IrregularShed
Copy link

This has caught me out as well. It looks like if you've run expo on Windows it leaves its adb.exe running in the background, presumably until you reboot. As a result, when you try and update expo-cli, there's processes locking you out. I figured this out through trial and error, so there's a step I'm listing that you probably don't need to do.

  • 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.)
  • 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.
  • 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 🤦‍♂️.)
  • 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.

That's exactly what I did, and now I'm up to date.

@fson fson changed the title npm install -g expo-cli gives error adb.exe is left running in the background (npm install -g expo-cli fails with "EPERM: operation not permitted, unlink '...\adb.exe') Jan 4, 2019
@fson fson added the bug Something isn't working label Jan 4, 2019
@cory-baker
Copy link
Author

Will try this when I get home, thanks.

@Silva-Amon
Copy link

This has caught me out as well. It looks like if you've run expo on Windows it leaves its adb.exe running in the background, presumably until you reboot. As a result, when you try and update expo-cli, there's processes locking you out. I figured this out through trial and error, so there's a step I'm listing that you probably don't need to do.

  • 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.)
  • 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.
  • 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 🤦‍♂️.)
  • 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.

That's exactly what I did, and now I'm up to date.

Thank you so much! It worked fine for me.

@AppleMango23
Copy link

ya the solution work perfectly tq!!

@mekwall
Copy link

mekwall commented Mar 11, 2019

This is a duplicate of #175. The above is merely a workaround. Expo CLI should make sure to kill the running adb process when itself exists.

@digicoparis
Copy link

digicoparis commented Aug 23, 2019

This is a duplicate of #175. The above is merely a workaround. Expo CLI should make sure to kill the running adb process when itself exists.

I agree, it's not super handy to have to kill the process on Windows before updating. It took me a while to find solution here, thanks to @IrregularShed.

Until I understood it was not about file permission on Windows 10 (I was running as administrator or root if you like), I was a bit lost. You just have to kill adb.exe process in task runner before updating expo-cli.

@brentvatne brentvatne self-assigned this Nov 22, 2019
@humandevs
Copy link

humandevs commented Feb 1, 2020

In my case, this issue appears to have only shown up when trying to uninstall exp-cli. Installing it (in order to update) completed without errors, but the old version was still being used somehow (confirmed with 'expo -V'). I had to kill adb.exe, then remove expo-cli, then install expo-cli (and note the old version was still installed and being used by running 'expo -V', even though the new version installed without errors), then re-remove expo-cli, then re-re-install expo-cli.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants