Operating system and version:
Ubuntu 16.04.3 LTS
nvm debug output:
nvm --version: v0.33.6
$SHELL: /bin/bash
$HOME: /home/build
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)'
uname -a: 'Linux 4.4.0-98-generic #121-Ubuntu SMP Tue Oct 10 14:24:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux'
OS version: Ubuntu 16.04.3 LTS
sed: -e expression #1, char 9: Unmatched ) or \)
curl: , curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
wget: /usr/bin/wget, GNU Wget 1.17.1 built on linux-gnu.
git: /usr/bin/git, git version 2.7.4
grep: /bin/grep (grep --color=auto), grep (GNU grep) 2.25
awk: /usr/bin/awk, GNU Awk 4.1.3, API: 1.1 (GNU MPFR 3.1.4, GNU MP 6.1.0)
sed: /bin/sed, sed (GNU sed) 4.2.2
cut: /usr/bin/cut, cut (GNU coreutils) 8.25
basename: /usr/bin/basename, basename (GNU coreutils) 8.25
rm: /bin/rm, rm (GNU coreutils) 8.25
sed: -e expression #1, char 9: Unmatched ) or \)
mkdir: , mkdir (GNU coreutils) 8.25
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.7.0-git
nvm current: none
which node:
which iojs:
which npm:
npm config get prefix: The program 'npm' is currently not installed. You can install it by typing:
sudo apt install npm
npm root -g: The program 'npm' is currently not installed. You can install it by typing:
sudo apt install npm
nvm ls output:v4.8.3
v5.3.0
v6.10.3
v6.11.0
v6.11.1
v6.11.2
v6.11.3
v6.11.4
v6.11.5
default -> lts/* (-> N/A)
node -> stable (-> v6.11.5) (default)
stable -> 6.11 (-> v6.11.5) (default)
iojs -> N/A (default)
lts/* -> lts/carbon (-> N/A)
lts/argon -> v4.8.5 (-> N/A)
lts/boron -> v6.11.5
lts/carbon -> v8.9.0 (-> N/A)
How did you install nvm? (e.g. install script in readme, homebrew):
install script in readme
What steps did you perform?
Opened a new terminal session (e.g. SSH client or new tmux tab).
What happened?
Error message:
````
N/A: version "N/A -> N/A" is not yet installed.
You need to run "nvm install N/A" to install it before using it.
````
What did you expect to happen?
No error message.
Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?
No.
Currently your default alias is set to lts/*- but the latest LTS is carbon, and you don't have any carbon nodes installed.
While this was how the feature was designed, I don't think I really thought this through for a world where there's multiple LTS lines, and you don't have the latest one installed.
For now, you can nvm alias default lts/boron, or nvm install lts/carbon, but I'll leave this open so that in your situation, lts/* falls back to the latest lts that is locally installed.
So to clarify, I think that lts/boron, for example, should always only point to the latest boron LTS version - eg, as soon as 6.12 was released, 6.11 was no longer in LTS.
However, I definitely think that lts/* should call back to lts/boron when there's no lts/carbon installed, etc.
I've just managed to fix this message by setting exact version of node in ~/.nvm/alias/default:
Had something like:
6.9.*
And changed to:
6.9.5
â–³ nvm ls
-> v6.9.5
v8.9.1
system
default -> 6.9.5 (-> v6.9.5)
node -> stable (-> v8.9.1) (default)
stable -> 8.9 (-> v8.9.1) (default)
iojs -> N/A (default)
lts/* -> lts/carbon (-> v8.9.1)
lts/argon -> v4.8.6 (-> N/A)
lts/boron -> v6.12.0 (-> N/A)
lts/carbon -> v8.9.1
@dkfiresky that's because nvm does not understand * - 6.9.x would work, as would 6.9 or lts/boron, but 6.9.* does not.
@ljharb oh, I see now. My reason to use the asterisk (*) was because of this: https://docs.npmjs.com/misc/semver#x-ranges-12x-1x-12-
Maybe NVM could support asterisk as well.
nvm doesn't understand semver; nvm --help has a nice big note at the top that describes what <version> means.
@ljharb: I have this issue on WSL/Bash on Windows (Ubuntu based).
"$NVM_DIR/nvm.sh" # This loads nvm
This also causes issues with automation tools like ansible where the exit code causes an error.
Edit: Yes, nvm install lts/* fixes the issue.
@strarsis you can run nvm unalias default as well, which should address it.
Pude resolverlo, Gracias.
This seems answered; closing.
Oops, reopening per https://github.com/creationix/nvm/issues/1651#issuecomment-343844676
Been using nvm for a couple of years, but I found this to be pretty confusing. I installed on a new system and decided to use the --lts flag to install node. I typically just install using a version number like v8.11.1. So, I ran nvm ls-remote --lts and it returned a list of available versions with the lts name capitalized, e.g. v8.11.1 (Latest LTS: Carbon). Naturally, I then ran:
nvm install --lts=Carbon --latest-npm
I logged out and then back into the shell and got the OP's error. Notice the output of nvm ls:
$ nvm ls
v8.11.1
default -> lts/Carbon (-> N/A)
node -> stable (-> v8.11.1) (default)
stable -> 8.11 (-> v8.11.1) (default)
iojs -> N/A (default)
lts/* -> lts/carbon (-> v8.11.1)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.14.1 (-> N/A)
lts/carbon -> v8.11.1
The default is set to lts/Carbon, the name I used during installation, but the actual is lts/carbon. Just to test it, I deleted my .nvm directory and started over so I could capture the install message:
$ nvm install --lts=Carbon --latest-npm
Installing with latest version of LTS line: Carbon
Downloading and installing node v8.11.1...
Downloading https://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v8.11.1 (npm v5.6.0)
! WARNING: Version 'lts/Carbon' does not exist.
Creating default alias: default -> lts/Carbon (-> N/A)
Attempting to upgrade to the latest working version of npm...
* Installing latest `npm`; if this does not work on your node version, please report a bug!
/home/nodebb/.nvm/versions/node/v8.11.1/bin/npm -> /home/nodebb/.nvm/versions/node/v8.11.1/lib/node_modules/npm/bin/npm-cli.js
/home/nodebb/.nvm/versions/node/v8.11.1/bin/npx -> /home/nodebb/.nvm/versions/node/v8.11.1/lib/node_modules/npm/bin/npx-cli.js
+ [email protected]
added 89 packages, removed 42 packages and updated 67 packages in 9.076s
* npm upgraded to: v5.8.0
Sure enough, even though the installation completes, we get a warning:
! WARNING: Version 'lts/Carbon' does not exist.
Creating default alias: default -> lts/Carbon (-> N/A)
If the lowercase name is required for the default alias to be setup correctly, then the --lts= switch on install should either require lowercase or convert to lowercase automatically. It's confusing having ls-remote --lts return the names capitalized, while install requires lowercase.
@jeff-kilbride thanks, that definitely seems like an issue, but seems unrelated to this one. Can you file a new one?
I have a similar problem to this one, but I'm not sure if I should open another issue. Whenever I open a new terminal on a directory with a .nvmrc file, I get this:
N/A: version "8.10 -> N/A" is not yet installed.
You need to run "nvm install 8.10" to install it before using it.
...where 8.10 is the contents of my .nvmrc. It doesn't matter what is there, whether that version is installed, etc., it prints those lines. It's not really every time for some reason though, it seems to only happen when I open a new panel/tab on my terminal emulator, not when starting the terminal or explicitly starting a new shell.
@Darkhogg since yours reads the "8.10" correctly, would you mind filing a new one?
Same bug on arch when you try: nvm alias default node
Although you get NA -> (infinity), which is interesting.
Showing alias gives: default -> (node -> (v10.0.0)) so I wonder if it's just the "double jump" that confuses nvm?
Nixed the problem. Not occurring with completely fresh nvm with no other conflicts
@c-dante can you file that separately as well?
Going to nix my addition - was having some annoying overlaps with AUR packages installing their own node, nvm having its own, and NPM's update for npm@6 having its own.
After a full uninstall and clean out of all my node/npm installs, nvm is working fine.
maybe just say that you set the nvm default incorrectly, use nvm ls-remote to find a valid node version for default
of coarse not allowing someone to set the alias default to an invalid thing would be better
The default isn't entirely incorrect here; it's just that lts/* points to the latest available LTS, not the latest installed LTS.
https://github.com/creationix/nvm/issues/1651#issuecomment-343844676 would, however, be a UX improvement.
Just ran into this on AWS Linux 2. The following fixes it.
nvm use stable
nvm alias default stable
Updated our script to be:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
. ~/.nvm/nvm.sh
nvm use stable
nvm alias default stable
npm install -g yarn
@MichaelLeeHobbs nvm install node should be sufficient to both install it, use it, and set it as the default (since it's the first version).
Most helpful comment
@strarsis you can run
nvm unalias defaultas well, which should address it.