Recently working with NodeJS ect. I installed quite different packages, for different tutorials + projects. I finally ended up with this kind of configuration:
louis@louis:~$ node -v
v5.10.0
louis@louis:~$ nodejs -v
v6.2.1
louis@louis:~$ npm -v
3.8.3
Can you explain the difference between these?
Recently working with NodeJS ect. I installed quite different packages, for different tutorials + projects. I finally ended up with this kind of configuration:
louis@louis:~$ node -v
v5.10.0
louis@louis:~$ nodejs -v
v6.2.1
louis@louis:~$ npm -v
3.8.3
Can you explain the difference between these?
nodejs
instead of just node
. In fact, you seem to have two different versions of Node.js installed.
– E_net4
Commented
Jun 7, 2016 at 10:33
Seems you have two different versions of nodejs
installed, possibly one was installed from sources and one from package manager like apt
.
louis@louis:~$ node -v
v5.10.0
This returns older version of nodejs that you installed, I remend you to remove it.
louis@louis:~$ nodejs -v
v6.2.1
This returns the current version of nodejs
installed, possibly you installed it using package manager, I remember in Ubuntu
it es by nodejs
executable name.
I suggest you to create link like this
sudo ln -s `which nodejs` /usr/bin/node
so it will be available using node
mand also.
nodejs vs node on ubuntu 12.04
louis@louis:~$ npm -v
3.8.3
This is just version of your npm
program and has nothing to do with nodejs
version.
Uninstall all versions that you have and install node
using nvm
to switch between old/new versions easily
To install or update nvm, you can use the install script using cURL:
curl -o- https://raw.githubusercontent./creationix/nvm/v0.31.1/install.sh | bash
or Wget:
wget -qO- https://raw.githubusercontent./creationix/nvm/v0.31.1/install.sh | bash
Usage
To download, pile, and install the latest v5.0.x release of node, do this:
nvm install 5.0
And then in any new shell just use the installed version:
nvm use 5.0
https://github./creationix/nvm#install-script
I assume you are using ubuntu. node
and nodejs
are the same tool, but node
is the legacy version and nodejs
the current development branch.
npm
however is the package manager for node(js)
.
Here's a bit of helpful information to add to the discussion and which will hopefully help you out regarding node version clashes.
Adding the NodeJs version to your $PATH in your .bash_profile (or it may be called .bashrc or .bashconfig) file will ensure your node calls from the terminal will use the latest and not the legacy version.
Using NVM (Node Version Manager) will allow you to install and change node versions on the fly with 'nvm use 6.0.0' and is highly remended as some NPM packages will break if using a node and npm version that isn't correct for certain npm packages in your node_modules dir. You will also have to add NVM to your $PATH in this case, but it's easy enough to do with:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
More details can be found in the link provided.
The OP's question was answered, I know, but I think pointing the OP to a better solution is also a good idea.