nvm-windows: ERROR open \settings.txt: The system cannot find the file specified.
Issue: After installing nvm (from WinGet in this case) and before restarting the terminal, attempting to use nvm will fail.
Now, you might think that restarting the terminal is a simple action the user can do but when you are trying to automate the installation of a bunch of apps and developer tools, it’s not a viable solution to restart the terminal.
Running nvm at this point will fail with the expected error:
nvm: The term 'nvm' is not recognised as the name of...
So the next step would be to invoke nvm directly, which fails with this error:
PS C:\Users\User> C:\Users\User\AppData\Roaming\nvm\nvm.exe install latest
ERROR open \settings.txt: The system cannot find the file specified.
How To Reproduce:
- Use WinGet to install nvm
winget install --id=CoreyButler.NVMforWindows -e
- Attempt to run nvm directly as the terminal session will not have the updated %PATH%
- Get weird error about missing settings.txt
Expected Behaviour:
It should be possible to automate the installation of developer tooling including nvm without needing to restart the terminal and thus no longer be possible to automate.
Screenshots:
Desktop:
- OS: Windows 11 - not tried on Windows 10, probably the same.
Additional context:
- I also raised an issue here about the possibility of Windows Terminal or WinGet just doing the right thing and refreshing the environment variables: https://github.com/microsoft/winget-cli/issues/3077
- I saw this other issue with the same error, but the suggested fix of running as admin made no difference: https://github.com/coreybutler/nvm-windows/issues/929
If this is some hard to fix error, could it be possible to add an argument to nvm which accepts a path of the settings file to use?
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 24 (7 by maintainers)
Commits related to this issue
- Move test command to 'debug'. Fixes #955 and #942. Addresses #945 with new encoding for settings (forcing UTF-8). — committed to coreybutler/nvm-windows by coreybutler a year ago
Is this a serious reply or some AI generated reply? Please read original issue comment to understand this problem, it’s context, and usage with automation scripts and tools like winget.
This error is because your current command line prompt does not have %NVM_HOME%, just close your command prompt and open it again and it should work.