-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Open
Labels
bugsOh no, something's broken :-(Oh no, something's broken :-(pull request wantedThis is a great way to contribute! Help us out :-DThis is a great way to contribute! Help us out :-D
Description
- Operating system and version:
CentOS 7, nvm latest version nvm debug
output:
$SHELL: /bin/bash
$HOME: /home/kenny
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)'
uname -a: 'Linux 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux'
OS version:
curl: /bin/curl, curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.28.4 zlib/1.2.7 libidn/1.28 libssh2/1.4.3
wget: /bin/wget, GNU Wget 1.14 built on linux-gnu.
git: /bin/git, git version 1.8.3.1
grep: alias grep='grep --color=auto'
/bin/grep (grep --color=auto), grep (GNU grep) 2.20
awk: /bin/awk, GNU Awk 4.0.2
sed: /bin/sed, sed (GNU sed) 4.2.2
cut: /bin/cut, cut (GNU coreutils) 8.22
basename: /bin/basename, basename (GNU coreutils) 8.22
rm: /bin/rm, rm (GNU coreutils) 8.22
mkdir: /bin/mkdir, mkdir (GNU coreutils) 8.22
xargs: /bin/xargs, xargs (GNU findutils) 4.5.11
nvm current: v9.10.1
which node: $NVM_DIR/versions/node/v9.10.1/bin/node
which iojs: which: no iojs in ($NVM_DIR/versions/node/v9.10.1/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:$HOME/.local/bin:$HOME/bin)
which npm: $NVM_DIR/versions/node/v9.10.1/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v9.10.1
npm root -g: $NVM_DIR/versions/node/v9.10.1/lib/node_modules
nvm ls
output:
v9.7.0
-> v9.10.1
default -> node (-> v9.10.1)
node -> stable (-> v9.10.1) (default)
stable -> 9.10 (-> v9.10.1) (default)
iojs -> N/A (default)
lts/* -> lts/carbon (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.14.1 (-> N/A)
lts/carbon -> v8.11.1 (-> N/A)
- How did you install
nvm
? (e.g. install script in readme, Homebrew):
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
nvm says 'no .nvmrc file found' when the problem is that the version inside of said .nvmrc is not installed.
I have a systemd service that calls nvm like this.
/home/kenny/.nvm/nvm-exec nodemon ./src/index.js
the output was:
Mar 31 21:06:00 vm5 start.sh[3021]: No NODE_VERSION provided; no .nvmrc file found
the contents of the .nvmrc file are:
v9.7.0
The error disappeared after running nvm install 9.7.0 --reinstall-packages-from=node
I got the thing to work but I want to inform you that the error message is wrong it should say that the version inside the .nvmrc
is not installed, not that there is no .nvmrc
file.
rpatterson
Metadata
Metadata
Assignees
Labels
bugsOh no, something's broken :-(Oh no, something's broken :-(pull request wantedThis is a great way to contribute! Help us out :-DThis is a great way to contribute! Help us out :-D
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
ljharb commentedon Apr 2, 2018
Thanks, this message should definitely be improved.
papandreou commentedon Nov 16, 2018
I've run into this a couple of times as well. It would have helped me if
nvm-exec
just didn't suppress the error message from the failingnvm use
command.Also, this particular instance of the problem could be sidestepped by
nvm-exec
runningnvm install
instead ofnvm use
. Maybe it could support an--install
switch similar tonvm use --install
?ljharb commentedon Nov 16, 2018
nvm use --install
isn’t a thing, because you can alwaysnvm install
to get that behavior. Since nvm-exec doesn’t have that choice, an install option for it might make sense.nvm-exec isn’t the primary use cases for nvm, so it makes sense to me that this hasn’t come up yet, but I’d accept a pr that improved the error message for nvm-exec as well.
papandreou commentedon Nov 16, 2018
Ah, sorry, I meant
nvm.sh --install
.Sounds good!
For the record, my use case for
nvm-exec
is a launch config for the vscode debugger so that the node version specified by the project's.nvmrc
gets picked up: microsoft/vscode#16173 (comment)t-markey commentedon Jun 16, 2022
bf commentedon Jul 6, 2023
This has not been fixed yet.
expected: nvm-exec to complain that v10 is not installed
actual result: No NODE_VERSION provided; no .nvmrc file found
ljharb commentedon Jul 6, 2023
@bf yes, the issue being open indeed means it has not been fixed yet :-)
nvm exec
: Do a version check onnvm-exec
#3308userwiths commentedon Mar 6, 2024
Hey, I tried to see if I could fix this one real quick.
After reading for some time through the code managed to get it to behave better on my local (Linux Arch) machine and display a more expressive message in case the versions differ.
Knowing this is a big project and heavily relied on would be glad to hear if this could be improved enough to resolve this issue or if it is even in the right direction.
Sample result with

v10
installedljharb commentedon May 16, 2024
@khs1337 nvm-exec isn't meant to be ran directly. nvm is a sourced shell script, and then you'd run
nvm install
to auto-install and use the .nvmrc version.