jasongin / nvs

Node Version Switcher - A cross-platform tool for switching between versions and forks of Node.js
Other
2.75k stars 211 forks source link

MSI uninstall fails with error code 2318 #22

Open aruneshchandra opened 7 years ago

aruneshchandra commented 7 years ago

nvs-error

aruneshchandra commented 7 years ago

The workaround is to manually delete the folder "%LOCALAPPDATA%\nvs\ch" launch Admin PowerShell console and use the following command. rm -recurse C:\Users\<username>\AppData\Local\nvs\ch -force

jasongin commented 7 years ago

This is a MAX_PATH problem. If you have installed under AppData\Local (the default for a per-user MSI install) and added some nightly builds having a long tag in the semantic version, e.g. 7.0.0-nightly2016112559950ad1e8, then some of the npm module files may have paths slightly exceeding 260 characters. Those paths will cause Windows Installer to fail and rollback when trying to clean up those files on uninstall.

Note in the suggested workaround above, you will need to replace ch with whatever remote name you used for the nightly builds:

rm -Recurse -Force "$env:LOCALAPPDATA\nvs\$remoteName"
jasongin commented 7 years ago

I want to keep this issue open, because other people may hit this. I'd like to fix it, but it might not be easy.

kfarnung commented 7 years ago

I must have had a really deep directory structure (there were quite a few "node_modules" folders in the path), so the workaround didn't quite work for me.

Ultimately I had to use robocopy to move the folder:

robocopy /s /move "$env:LOCALAPPDATA\nvs\$remoteName" "C:\f\"

Then delete the folder I created:

rm -Recurse -Force "C:\f\"

After I did that the upgrade succeeded.

ealib commented 7 years ago

It happened to me too while upgrading from 1.2.0 to 1.3.0. I had to create a symlink to the nvs install directory, remove node from there, and install 1.3.0 again:

C:\>mklink /D nvs "%LOCALAPPDATA%\nvs"
C:\>pushd nvs
C:\nvs>rd /s /q node
C:\nvs>popd
C:\>pushd "%LOCALAPPDATA%"
C:\Users\username\AppData\Local>rd /s /q nvs
C:\Users\username\AppData\Local>popd
C:\>
vickylance commented 7 years ago

@jasongin Hi thanks for pointing me to this issue. But I was able to solve this issue by installing it manually using an elevated command prompt. I used the below commands from the manual installation instruction.

set NVS_HOME=%ProgramData%\nvs git clone https://github.com/jasongin/nvs "%NVS_HOME%" "%NVS_HOME%\nvs.cmd" install nvs --version

And it was successfully updated.

kxws888 commented 6 years ago

i hit this problem on my mac.

kfarnung commented 6 years ago

@kxws888 this should be a Windows-specific problem. If you're seeing issues on macOS can you open a new issue including any error output?