Nvm-windows: ERROR open \settings.txt:

Created on 21 Nov 2014  Â·  57Comments  Â·  Source: coreybutler/nvm-windows

After installation process I just ran "npm" and it says:

ERROR open \settings.txt: [...]

Most helpful comment

I had the same Issue. https://github.com/coreybutler/nvm-windows/issues/23 @colmsjo's comment resolved it for me.

Simply remove %NVM_HOME% and NVM_SYMLINK from the _user_ environment variables.

All 57 comments

Does the settings file exist in your installation directory?

Does the installation directory mean the folder where the installed application is or where the installer is?

Where the installed application goes... the default for this is C:\Users\<yourusername>\AppData\Roaming\nvm. It should look something like this:

image

The main files to look for are elevate.cmd, elevate.vbs, nvm.exe, and settings.txt, as well as nodejs.ico (which is just the icon, it doesn't provide any functionality).

If settings.txt does not exist, then it probably wasn't created during the installation process. The installer should do this for you, but the manual install does not. If you used the installer and do not see the settings.txt file, then there is probably a bug in the installer that I'd be interested in tracking down and fixing.

The settings file should contain content similar to:

root: C:\Users\Corey\AppData\Roaming\nvm
path: C:\Program Files\nodejs

Hi, this happened to me, too. After the installer finished it opened cmd.exe, and cmd.exe opened with that error message.

settings.txt does in fact exist in my installation folder.

When I examine my new path variable, it has this at the end: " [...my previous paths...];%NVM_HOME%;%NVM_SYMLINK% "

So it seems like, possibly those %variables% are not getting evaluated into actual dirs before appending them to the search path during the installer? When I manually add the right dirs to my path, it appears to work, although I'm new to node.js so I have very little idea what I'm talking about yet.

@bobbycircle - It is possible the variables aren't being evaluated at the right time... I'll have to look into that. I didn't think about that before because... well it has been working and I haven't changed that part of the installer. I'll look into this as soon as I can.

Same thing here. As per @bobbycircle, manually tweaking my PATH variable sorted it out.

I encountered the same error after installation. On Windows 8+, you need to create a new cmd window to see the evaluated %nvm_home% and %nvm_symlink% environment variables. This is a change from Win 7 to 8 where an existing windows explorer shell can not create a new process and see the new environment variables. If you are starting cmd.exe from Explorer, you need to first close Win Explorer and restart it to see new Env variables.

@dan-sterling - I have not encountered this with Windows 8 (which is what I developed this on). This is specifically why the user attributes are set as well, then the cmd shell will pickup on the path. It shouldn't matter though - I'm building an entirely new installer to resolve these issues.

Got the same problem. What's more, creating settings.txt in that directory didn't fix it. I needed to create it at ~

I had the same Issue. https://github.com/coreybutler/nvm-windows/issues/23 @colmsjo's comment resolved it for me.

Simply remove %NVM_HOME% and NVM_SYMLINK from the _user_ environment variables.

Same issue here. I followed @queckezz's solution, it works.

I have also this issue everytime I install it, I think that launching cmd.exe at the end of installation is not a good idea as it may fail too often giving a bad first impression of the tool.

I would rather not launch cmd.exe and ask the user to close his Windows session, open a new one and then try nvm in a command prompt window.

Also, ran into this problem, when running the 1.0.6 installer. Windows 8, Ran the installer as Admin. file.exe was not in my path. Install of GnuWin32 also did not solve the problem. Node had not been installed yet.

I could use to copy settings.txt to c:\ .

@bobbycircle solution worked for me.

I encountered this issue also (windows 8.1). Closing and restarting the command prompt didn't help (process may still have been running - didn't check). On a hunch, I restarted windows. Problem resolved: no mucking around with the installer PATH vars. Give it a shot before changing anything
@coreybutler - may also be a good failsafe for the installer: trigger a restart at the end "for your changes to take effect" to eliminate some of the user environment variances.

Sometimes, when tweaking environnement variables, this can happen :+1:

  • You didn't push "OK" button on the "Edit environnement variable" window
    Yup. This might look dumb, but i actually spent a lot of time, changing vars and restarting PowerShell, and nothing was happening ... until i closed this window ! Clicking the "OK" button is VERY important, if you close the window or cancel, your modifications will be discarded. Then just reload your term.
  • You term can be faulty, try another one.
    If you are using Github for Windows and Git, you might end up with 3 terms (PowerShell, Git Shell, Git Bash). Each term can have his own environnement, and tweaking values will not solve anything. Try PowerShell or cmd.exe (vanilla windows terms) before.

Just ran into this on Windows 8 as well.

run your cmd terminal as adminstrator

Is it possible that this failed because the install failed .. because of a space in the User folder? This occurs in bug/issue #41 so maybe that's happening here, too?

@queckezz solution worked

@queckezz solution worked. thank u

I had this issue.

The installer ran with elevated privileges (required for installation).
The cmd session it launched then also runs with elevated privileges, but refused to see the settings .txt

Relaunching a non-admin cmd saw settings.txt just fine, and nvm now also runs fine in a admin session launched as an admin.

@queckezz solution also worked for me. Thanks

@queckezz solution worked +1

I had the same problem. The issue was that "C:\Program Files\nodejs" was in my user path, right before the new vars ;%NVM_HOME%;%NVM_SYMLINK%.

In my case (Windows 7 and Windows 8.1), this phenomenon occurs just after the installation.
If I reboot after installation, nvm for windows works normally

+1 for @sanori and rebooting after install fixing

The problem is that PATH was not correctly updated, meaning that in my case I found that PATH value was ...";%NVM_HOME%;%NVM_SYMLINK%. Those ... are the existing entries, but a double quotes was added before semi colon.

Once this was corrected, PATH = ...;%NVM_HOME%;%NVM_SYMLINK% everything works correctly.
You don't have to copy settings.txt in C:, D: or whatever drive you are using when running nvm tool.

I also noticed the %vars% in my path, but by then had reverted to just having the active version of Node installed, so just removed them.

I can't believe they (MicroSoft) haven't improved the systems properties method of modifying the path. I'm sure it's been the same narrow textbox since XP days.

Setting env vars on Windows works just fine. You can even do it from powershell:

[System.Environment]::SetEnvironmentVariable("MYVAR", "WHATEVER", "Machine")

I fixed this issue by going to %AppData%/nvm and changing the security of the settings.txt file so Everyone had full full access to the file.

If you'd prefer not to do this you could also try running nvm from command prompt with elevated privileges. Using run as administrator.

After it didn't work from the initially loaded "Run Cmd". I loaded an administrator cmd and ran nvm list which worked. Then when I went back to a regular cmd window it continued to work.

I got this error when I installed the first time. Then I ran the installer as administrator, all is well.

I installed is and all that needed doing was to restart windows. I get the sense that cmd just needed to get reset with the new Environment variables.

Same issue here. I followed @queckezz's solution, it works.

+1 restart on Win7

For anyone who can't get it working either :: TRY THIS

Just close all your instances of CMD prompt and re-open as Administrator (just in case).
Fixed it for me

@mcpDESIGNS thank you, it helped me too!

I have the same problem in Win10 x64.
But in my case is because the symbolic link pointed to a unexisting folder in C (C:\Program Files\nodejs\v1.1.2).
The only folder in nodejs folder is "v4.0.0", so i needed to remove symlink and create another using mklink /j "C:\Program Files\nodejs" "G:\Program Files (x86)\nvm

This is still an issue on Windows 7 as of 2.1.2016. The variables are not being evaluated in a child cmd.

Solution is to open a fresh cmd window.

@coreybutler I suppose you are using SETX VAR value and start cmd.

SETX VAR value sets environmental variable named VAR for fresh instances of cmd only
start cmd starts a children of current cmd that uses parent's environment

A workaround is to supplement the SETX with SET VAR=value to duplicate the value to current environment for child processes.

I tried many of the above solutions, and the only one that ended up working for me was to restart Windows 7. :disappointed:

FYI: Windows 7 support = deprecated.

@vferko - I'm not explicitly using SET or SETX. The InnoSetup engine handles all of this. I believe the problem is in sequencing. Sporadically, the installer appears to be launching the cmd window before the environment variable setup methods are complete.

FYI: The ERROR open settings.txt: [...] happened to me on a Win10 x64. After open a new cmd window seems there is all ok :)

Still happens with the 1.1.0 in Win10 x64. Same as @DCorto

restart cmd.exe and you're good

I've got somehow different symptoms, but it seems to be related to this issue:

  • Win7 64bit, installation successful, but 'nvm' is not recognized as an internal or external ...
  • After every system restart, nvm can be run from the command line, until the first nvm use - then again 'nvm' is not recognized ...
  • Deleting the User variables NVM_HOME and NVM_SYMLINK solved the issue (%vars% replaced in PATH with their values)

This should be resolved with the new installer. InnoSetup was upgraded for v1.1.7 and several new changes were made to install.cmd. Windows 7 is also not technically supported, by NVM4W or Microsoft.

I got same error with the new 1.1.7 where is the user variable i dont see it on settings.txt

Sorry just restart the computer and its work 💯

This error is still present. I was using NVM without an issue for a while and now I've had a project which required me to move my NPM cache directly to the C drive (to avoid long path issues) and after I've made this change (probably, that's the only NPM configuration change that I did and the same day this started happening…) this issue started happening.

I found that running Powershell as an admin allow me to run NVM with no issues, which is a workaround I'll be using for now (I might set the settings.txt file permissions to "anything goes" like the other poster if it gets too annoying).

I don't think this will be a fix for all. But maybe for some. SHORT ANSWER: Try closing the command window and opening a new command window. LONG ANSWER: I found that if I installed nvm using the nvm_setup.exe (downloaded in nvm_setup.zip) from the windows command line (cmd.exe command window) and then tried to run nvm in the same command window session (right after installing), it gave me this error - ERROR open settings.txt. I looked and the paths were added to my system PATH settings fine. So, I closed the command line window and opened up a new command window. It then worked. I think even though the install adds the path to nvm.exe (and to settings.txt) to the Windows PATH, it isn't recognized in that same command window yet. Close the command window and open a new one. Hope this helps someone. A suggestion for the installer is maybe give a message to user at beginning of install that the command window will close once install is complete. Then, just close the command window when the install finishes. Then the user is forced to open a new command window after installation.

Still happens with the 1.1.0 in Win10 x64. Same as @dcorto

restart cmd.exe and you're good

same with win10 + powershell, just close instance of cmd or powershell and restart a new cmd or powershell

InnoSetup doesn't always respect the order of operations when writing the initial settings file and setting the path. This is why reopening the window works after initial install.

I got error when i ran npx create react app it says enter the exact path where the zip file is extracted/copied: it's having after nvm installation and installation of node 12.

Still happens with the 1.1.0 in Win10 x64. Same as dcorto

restart cmd.exe and you're good

This stil works (as workaround) @Muizuddeen

Found that if you copy the settings.txt to c: works too

Was this page helpful?
0 / 5 - 0 ratings

Related issues

petrovicz picture petrovicz  Â·  4Comments

webspecialist picture webspecialist  Â·  5Comments

David263 picture David263  Â·  3Comments

AllainPL picture AllainPL  Â·  7Comments

ctsstc picture ctsstc  Â·  3Comments