-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Need to manually remove folder on nvm uninstall #252
Comments
If you run |
Yes, indeed - after install/use/uninstall, nvm ls still shows the
uninstalled version.
BTW, if I rename node.exe to node64.exe prior to uninstallation, the
version is removed completely (without having to manually remove the
folder).
|
OK, I've marked this as a bug. Which version of Windows are you running? |
Which version of Windows are you running?
Windows 10 (anniversary update) x64
|
Hi,
afaict (but I'm not a Go developer) in arch.go:SearchBytesInFile the
opened file is never closed. So when os.RemoveAll tries to delete the
files there is a sharing violation.
I'm somewhat surprised though that this has not been reported before,
because I think that the bug should occur everytime a "used" version
(which contains node.exe) shall be uninstalled.
|
Once the executable completes an operation, it is no longer associated to any files. In other words, the executable runs one operation, then closes all file connections by exiting. However; I have not had a chance to personally test this on the latest Windows build. If Windows is now using a file lock for this operation, then you may be right... that could be lingering. I'll try to debug this as soon as I can, but I'm on a contract job this week and have SXSWi obligations. So, it may be awhile before I can actually sit down with this. |
Once the executable completes an operation, it is no longer associated to any files. In other words, the executable runs one operation, then closes all file connections by exiting.
IMO: nvm.exe opens node.exe (and only that, not node64.exe or alike)
and scans a couple of bytes, but it doesn't close the file handle.
Then nvm.exe tries to remove the folder (but of course hasn't exited
in between, so the file handle is still open).
However; I have not had a chance to personally test this on the latest Windows build. If Windows is now using a file lock for this operation, then you may be right... that could be lingering.
It's not really a file lock. I let nvm.exe output the error and it
reads "The process cannot access the file because it is being used by
another process" (which is the same message if it is in the very same
process).
I'll try to debug this as soon as I can, but I'm on a contract job this week and have SXSWi obligations. So, it may be awhile before I can actually sit down with this.
Okay, no problem. If you just could fix it in the next version.
Thanks!
|
I did a little testing and this only occurs if you nvm use x.x.x the version to be removed AND you are using arch 64. As has been mentioned the node64.exe is renamed to node.exe and not removed. However, if you use another version and manually rename node.exe to node64.exe (as ujaroe mentions) then the uninstall is completed successfully. This means there is a couple of ways to correct the problem. I would recommend 'nvm use' restoring the version folder the use command is moving FROM back to the original state. The other is having uninstall check arch and make sure the node executable matches the arch of the version. There are a couple other things that could be done with symlinks but I think these are the best two options. My Go skill is pretty low but I will attempt to build one or both of these soon. edit: spelling |
Same issue here. CLI output:
After running the But, the |
I can confirm this one. Also happened to me on Win10 x64 using node v6.9.1 and nvm 1.1.3 |
Also happened on Win10 x64 (version 1709) using node v8.11.1 and nvm 1.1.6 |
Hi, @coreybutler,the bug also happened on Windows10 x64, and if i use |
Fixes #252 - Need to manually remove folder on nvm uninstall
need to reopen due to same issue on macOS |
Hi,
here are the steps to reproduce (including error description). This happens on x64 system,
nvm install x.y.z (6.10.0 or alike, but version doesn't matter)
nvm uninstall x.y.z
=> uninstallation successful, no leftover
nvm install x.y.z
nvm use x.y.z
nvm use u.v.w (another version - just to be sure x.y.z is not used - this step is probably not necessary)
nvm uninstall x.y.z
=> need to remove folder x.y.z manually from nvm path, which always contains node.exe alone
IMO, this happens because before the "use" there is a node64.exe, which is renamed on "use" into node.exe. This node.exe remains from this point on and obviously blocks removal of folder.
I hope the description is clear enough.
Thanks
The text was updated successfully, but these errors were encountered: