16

I think I may have done something untoward during the install process of nodejs and nvm.

When I start bash or open a terminal I get:

:~$ bash
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.

Using nvm ls from the command line I get:

result of <code>nvm ls</code>

going through my history I did find two lines where I'd tried to set an alias (I do believe I got that from a set of instructions I was following)

As far as I know, I'm not having any errors, other than when bash starts up, and those lines are generated from .bashrc:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

My primary aim here is to understand the output of nvm ls and is there anything there that needs to be fixed.

A bonus aside is, how do I get rid of these errors on logging in (other than simply deleting the last two lines) ;)

I'm on ubuntu 17.04

Update:

After checking the link in Matt's answer I see that these are the instructions I saw. It appears I missed a little here and there. This is what I have done and the results so far:

After checking out the link and runnin the update not much had changed except the lts/boron version number. Being yellow, I'm guessing it's not installed anyway. Still not sure why it's in my list then.

after first update

within the instructions I found I missed this one:

nvm install iojs-v1.0.3

That fixed <code>iojs</code>

So then I tried:

install node, cleared the node->stable line

So I've cleared the red node -> stable and the iojs -> N/A lines. They're now a nice green. I realised the first default line was an alias.

I set the alias correctly:

things are looking better

Doing all these extra steps has finally got rid of my login errors, so that's a plus.

So I still have the yellow lts entries...

I'd still like to know should they be there, have I done something to make them appear, should they be installed? Is there a problem not having them installed?

The funny thing about how it has been setup; I have been running node and electron apps without any issue what so ever! Just adding to my confusion.

Madivad
  • 2,999
  • 7
  • 33
  • 60
  • The best way to check if a command has installed run command --version .... If installed you should see a version number print to the command line – Matt Aug 05 '17 at 14:22

2 Answers2

12

nvm is simply showing the default aliases, even though there are not versions installed for all those aliases.

By default, nvm doesn't install any Node versions, but it comes with the following aliases:

  • node and stable point to the latest version of Node.js.
  • iojs points to the latest version of io.js, an old unmaintained fork of Node.js.
  • lts/aragon points to the latest version of the Node LTS Aragon line (which is Node 4)
  • lts/boron points to the latest version of the Node LTS Boron line (which is Node 6)
  • lts/* points to the latest LTS release of Node.js, which is the same as lts/boron as of Aug 2017. (This will change when Node 8 moves into LTS)

Since you don't have any Node versions installed, it shows that those aliases don't point to any currently installed Node version, hence the N/A.

If you just want to run the latest version of Node.js, just run nvm install node.

Don't bother installing iojs or older versions of Node.js unless you need them. Just ignore the N/A output, nvm is just reminding you that these aliases do exist.

RyanZim
  • 6,609
  • 1
  • 27
  • 43
  • anyway to get ride of those useless aliases? – Penghe Geng Aug 23 '18 at 01:20
  • 1
    I've used `rm -rf $HOME/.nvm/alias/lts` to remove those `lts` aliases. – Penghe Geng Aug 23 '18 at 01:22
  • @PengheGeng That may work, but there's no real reason to remove them; unused aliases don't do any harm. – RyanZim Aug 23 '18 at 15:25
  • @RyanZim a bit late to the party but they're actually getting in the way when using completions to switch between node versions (`nvm use `+TAB will show all aliases regardless of whether they're installed or not) – Dagan Sandler Jan 16 '20 at 16:31
  • 1
    using the code `nvm alias default node` (found in `nvm man`) helped to get rid of the unwanted notification "N/A: version "_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._" on terminal startup – Jacob Anderson Mar 09 '21 at 22:52
0

Have you tried

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

This is the installer script for NVM as documented on GitHub. When I visited npm they directed me to this page with instructions: NVM github

The documentation also mentions that you need to choose the shell and open it again after installation. This maybe with a try.

nvm ls should lost the versions of node packages installed

Listing versions

If you want to see what versions are installed:

nvm ls

Matt
  • 879
  • 9
  • 29