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
install.cmd
set %PATH% Failure
#467
Comments
https://stackoverflow.com/a/35352014/4739810 Basically its due to the fact that setx by design, once set, will only persist for the next cmd window opened and not the current window. I've been fighting with this for a while as well with the no-install on a docker image. What i've had to do is the following to get these variables to stick:
Probably unrelated, but once i have all my env variables set up on the docker image, i run
Removing the spaces got them on the sasme line, but it must seem like the parsing logic (somewhere here: Line 728 in 0d5e2c7
: (colon space).
Edit: I believe this is due to content encoding for echo within the docker commands. I can run that same command with spaces when running inside the docker container just fine. |
set TEST_ENV then read in current console, We'll get invalid.
if read on a new window, We'll get valid.
so, We'll get invalid value when set env then read back in a script.
btw:
notepad "%NVM_HOME%\settings.txt"
this command needs a quote(""). because, maybe the path of NVM_HOME has blank character.
current console
open a new console after set TEST_ENV
meyers@tom.com
From: Jake Anstadt
Date: 2019-08-21 02:15
To: coreybutler/nvm-windows
CC: meyerlee; Author
Subject: Re: [coreybutler/nvm-windows] `install.cmd` set %PATH% Failure (#467)
https://stackoverflow.com/a/35352014/4739810
I've been fighting with this for a while as well with the no-install on a docker image. What i've had to do is the following to get these variables to stick:
RUN [Environment]::SetEnvironmentVariable('NVM_HOME', 'C:\Users\ContainerAdministrator\AppData\Roaming\nvm', [System.EnvironmentVariableTarget]::Machine);
RUN [Environment]::SetEnvironmentVariable('NVM_SYMLINK', 'C:\Program Files\nodejs', [System.EnvironmentVariableTarget]::Machine);
RUN setx /M PATH $($Env:PATH + '%NVM_HOME%;%NVM_SYMLINK%;')
RUN echo "root:$Env:NVM_HOME`npath:$Env:NVM_SYMLINK`narch:64`nproxy:none" > $Env:NVM_HOME\settings.txt
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
If this is a question about how to use NVM4W, please use stackoverflow instead.
If this is an issue regarding antivirus, make sure you search the existing issues first.
My Environment
Windows 7 or below (not truly supported due to EOL - see wiki for details)
Windows 8
Windows 8.1
Windows 10
Windows 10 IoT Core
Windows Server 2012
Windows Server 2012 R2
Windows Server 2016
My Windows installation is non-English.
I'm using NVM4W version:
I have already...
My issue is related to (check only those which apply):
Expected Behavior
PATH="%PATH%;%NVM_HOME%;%NVM_SYMLINK%"
Actual Behavior
PATH="%PATH%;;"
Steps to reproduce the problem:
setx /M ENV read it back immediately, %ENV% will been empty.
Modified:
@echo off
set /P NVM_PATH="Enter the absolute path where the zip file is extracted/copied to: "
set NVM_HOME=%NVM_PATH%
set NVM_SYMLINK=C:\Program Files\nodejs
setx /M NVM_HOME "%NVM_HOME%"
setx /M NVM_SYMLINK "%NVM_SYMLINK%"
setx /M PATH "%PATH%;%NVM_HOME%;%NVM_SYMLINK%"
if exist "%SYSTEMDRIVE%\Program Files (x86)" (
set SYS_ARCH=64
) else (
set SYS_ARCH=32
)
(echo root: %NVM_HOME% && echo path: %NVM_SYMLINK% && echo arch: %SYS_ARCH% && echo proxy: none) > %NVM_HOME%\settings.txt
notepad "%NVM_HOME%\settings.txt"
@echo on
The text was updated successfully, but these errors were encountered: