-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EPERM: operation not permitted #79
Comments
What is strange is that I can do |
You're right, you shouldn't need to run as administrator for installation in your user directory. In this case I think that error message is misleading. The rename must have failed for some other reason. I've seen a couple reports of this in the past, but haven't been able to reproduce it myself. Maybe a virus scanner or something is locking the directory? I don't know. Does it happen again if you retry? |
What errors are you seeing from |
Here is some more output: C:\Users\brodybits\chris-work
λ nvs add lts
Already added at: %LOCALAPPDATA%\nvs\node\8.9.3\x64\node.exe
To use this version now: nvs use node/8.9.3/x64
C:\Users\brodybits\chris-work
λ nvs ls
node/8.9.3/x64
C:\Users\brodybits\chris-work
λ nvs ls
node/8.9.3/x64
C:\Users\brodybits\chris-work
λ nvs use lts
Specified version not found.
To add this version now: nvs add node/lts
C:\Users\brodybits\chris-work
λ node --version
'node' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\brodybits\chris-work
λ nvs --version
1.4.3
C:\Users\brodybits\chris-work
λ nvs ls
node/8.9.3/x64
C:\Users\brodybits\chris-work
λ nvs use carbon
Specified version not found.
To add this version now: nvs add node/carbon
C:\Users\brodybits\chris-work
λ nvs use 8
PATH += %LOCALAPPDATA%\nvs\node\8.9.3\x64
C:\Users\brodybits\chris-work
λ nvs ls
>node/8.9.3/x64
C:\Users\brodybits\chris-work
λ nvs link 8
%LOCALAPPDATA%\nvs\default -> %LOCALAPPDATA%\nvs\node\8.9.3\x64
User profile PATH += %LOCALAPPDATA%\nvs\default
C:\Users\brodybits\chris-work
λ nvs add boron
Downloading [###########################################################################################] 100%
Extracting [###########################################################################################] 100%
EPERM: operation not permitted, rename 'C:\Users\brodybits\AppData\Local\nvs\node\6.12.2\x64\node-v6.12.2-win-x64\node_modules' -> 'C:\Users\brodybits\AppData\Local\nvs\node\6.12.2\x64\node_modules'
Try running again as Administrator.
C:\Users\brodybits\chris-work
λ nvs ls
>#node/8.9.3/x64
node/6.12.2/x64
C:\Users\brodybits\chris-work
λ nvs use boron
Specified version not found.
To add this version now: nvs add node/boron
C:\Users\brodybits\chris-work
λ nvs use 6
PATH -= %LOCALAPPDATA%\nvs\node\8.9.3\x64
PATH += %LOCALAPPDATA%\nvs\node\6.12.2\x64
C:\Users\brodybits\chris-work
λ node --version
v6.12.2 I just got an updated Lenovo laptop from a computer repair shop and they added some kind of an antivirus program. I would not be surprised if this would be the explanation. I will leave this in case someone finds a better explanation in the future, will just manage by major version number for now. |
P.S. Adding another link in case it may be relevant: https://stackoverflow.com/questions/22325031/npm-please-try-using-this-command-again-as-root-administrator |
It looks like because of that |
After removing and adding back a couple times it seems to be OK now. I am wondering if there is some intermediate path that was not created the right way the first time around? Here is the additional output: C:\Users\brodybits\chris-work
λ node --version
v6.12.2
C:\Users\brodybits\chris-work
λ nvs rm boron
Specify a semantic version.
C:\Users\brodybits\chris-work
λ nvs rm carbon
Specify a semantic version.
C:\Users\brodybits\chris-work
λ nvs rm lts
Specify a semantic version.
C:\Users\brodybits\chris-work
λ nvs rm 6 8
PATH -= %LOCALAPPDATA%\nvs\node\6.12.2\x64
PATH += %LOCALAPPDATA%\nvs\default
- C:\Users\brodybits\AppData\Local\nvs\node\6.12.2\x64
C:\Users\brodybits\chris-work
λ nvs ls
>#node/8.9.3/x64
C:\Users\brodybits\chris-work
λ nvs rm 8
User profile PATH -= %LOCALAPPDATA%\nvs\default
- %LOCALAPPDATA%\nvs\default
PATH -= %LOCALAPPDATA%\nvs\default
- C:\Users\brodybits\AppData\Local\nvs\node\8.9.3\x64
C:\Users\brodybits\chris-work
λ nvs ls
C:\Users\brodybits\chris-work
λ nvs add lts
Extracting [###########################################################################################] 100%
EPERM: operation not permitted, rename 'C:\Users\brodybits\AppData\Local\nvs\node\8.9.3\x64\node-v8.9.3-win-x64\node_modules' -> 'C:\Users\brodybits\AppData\Local\nvs\node\8.9.3\x64\node_modules'
Try running again as Administrator.
C:\Users\brodybits\chris-work
λ nvs add boron
Extracting [###########################################################################################] 100%
Added at: %LOCALAPPDATA%\nvs\node\6.12.2\x64\node.exe
To use this version now: nvs use node/6.12.2/x64
C:\Users\brodybits\chris-work
λ nvs use boron
PATH += %LOCALAPPDATA%\nvs\node\6.12.2\x64
C:\Users\brodybits\chris-work
λ node --version
v6.12.2
C:\Users\brodybits\chris-work
λ nvs ls
node/8.9.3/x64
>node/6.12.2/x64 (Boron)
C:\Users\brodybits\chris-work
λ nvs rm carbon
Specify a semantic version.
C:\Users\brodybits\chris-work
λ nvs rm 8
- C:\Users\brodybits\AppData\Local\nvs\node\8.9.3\x64
C:\Users\brodybits\chris-work
λ nvs add lts
Extracting [###########################################################################################] 100%
Added at: %LOCALAPPDATA%\nvs\node\8.9.3\x64\node.exe
To use this version now: nvs use node/8.9.3/x64
C:\Users\brodybits\chris-work
λ nvs ls
node/8.9.3/x64 (Carbon)
>node/6.12.2/x64 (Boron)
C:\Users\brodybits\chris-work
λ nvs use lts
PATH -= %LOCALAPPDATA%\nvs\node\6.12.2\x64
PATH += %LOCALAPPDATA%\nvs\node\8.9.3\x64
C:\Users\brodybits\chris-work
λ node --version
v8.9.3 |
Closing since I haven't heard any further reports of this problem. Feel free to reactivate if it's still valid. |
@jasongin I regularly get this issue when running |
Add nvs v1.5.1, a more powerful Node.js versions tool on Windows than nvm-windows made by @jasongin. - Name: Node Version Switcher - Description: A cross-platform tool for switching between versions and forks of Node.js - Version: 1.5.1 - Homepage: https://github.com/jasongin/nvs - Basic usage - To add the latest version of node: ```powershell $ nvs add latest ``` - Or to add the latest LTS version of node: ```powershell $ nvs add lts ``` - Then run the `nvs use` command to add a version of node to your PATH for the current shell: ```powershell $ nvs use lts PATH += ~/.nvs/node/10.14.2/x64 ``` - To add it to PATH permanently, use `nvs link`: ```powershell $ nvs link lts ``` - Known Issue: Sometimes nvs will show an `EPERM: operation not permitted.` error during first adding some Node.js version, and it is due to JavaScript `fs.renameSync` function. The author hasn't been able to reproduce it himself (jasongin/nvs#79 (comment)), and in my practice, `nvs rm` and `nvs add` again should solve the problem. This only occurs in first `nvs add` run after re/install nvs.
Reopening because some people are still hitting this. I'll try to investigate more. |
I got an EPERM error when I install nvs by msi, and also got it by git clone into some non-system volumn (E:..., not $Env:LOCALAPPDATA). In such situations, simply rm and add didn't solve the error. By setting $Env:NVS_HOME to some subdir that is not root dir of nvs, the error occurs as before. But when I try to make a scoop manifest and persist the NVS_HOME, the error gone occasionally. Sometimes it happens once after first nvs add, and rm/add is okay. And sometimes it is always okay. I try to delete persisted nvs_home for a pure installation and not delete for a reinstallation, but things happened irregularly. This is due to some dir permission inheritance during fs.renameSync(), that is what I can sure, and I hope it should help. |
Just got this error running Tarvis CI job (windows os):
See here why EPERM error is happening on Windows isaacs/node-graceful-fs#119. So often it happens because the resource is locked, but not because of a lack of access rights. I use this module to cope with EPERM errors on Windows https://github.com/vladimiry/fs-no-eperm-anymore. |
Thanks for the links, those are helpful! I will put some form of EPERM workaround into nvs. |
Fixed in |
Given a local installation I encountered the following error when attempting to add a Node version:
I don't think I should have to run as administrator if I have everything installed in my local area. Or am I mistaken somehow?
The text was updated successfully, but these errors were encountered: