admin管理员组文章数量:1026662
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?
Share edited Jun 7, 2016 at 10:32 JJJ 33.2k20 gold badges94 silver badges103 bronze badges asked Jun 7, 2016 at 10:30 Louis LecocqLouis Lecocq 1,8143 gold badges18 silver badges40 bronze badges 4-
1
What operating system are you on? Some Ubuntu packages might install Node.js as
nodejs
instead of justnode
. In fact, you seem to have two different versions of Node.js installed. – E_net4 Commented Jun 7, 2016 at 10:33 - 2 Although not a bad question, this looks like a question that does not belong on SO. – Randy Commented Jun 7, 2016 at 10:34
- @randy thought the same but was not sure where to assign it with a flag. Since it is a programming tool, it does not fit into super-user, it is not highlevel enough for server fault, etc. – Toxantron Commented Jun 7, 2016 at 10:36
- Quite agree. Sorry @randy. I also thought about it before posting my question. But there's not a lot of place with such a developer munity. And as there is some post that also talk about configurations/build. It finally fit the purpose of SO. In my opinion. – Louis Lecocq Commented Jun 7, 2016 at 10:37
3 Answers
Reset to default 4Your situation
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.
Better solution
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.
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?
Share edited Jun 7, 2016 at 10:32 JJJ 33.2k20 gold badges94 silver badges103 bronze badges asked Jun 7, 2016 at 10:30 Louis LecocqLouis Lecocq 1,8143 gold badges18 silver badges40 bronze badges 4-
1
What operating system are you on? Some Ubuntu packages might install Node.js as
nodejs
instead of justnode
. In fact, you seem to have two different versions of Node.js installed. – E_net4 Commented Jun 7, 2016 at 10:33 - 2 Although not a bad question, this looks like a question that does not belong on SO. – Randy Commented Jun 7, 2016 at 10:34
- @randy thought the same but was not sure where to assign it with a flag. Since it is a programming tool, it does not fit into super-user, it is not highlevel enough for server fault, etc. – Toxantron Commented Jun 7, 2016 at 10:36
- Quite agree. Sorry @randy. I also thought about it before posting my question. But there's not a lot of place with such a developer munity. And as there is some post that also talk about configurations/build. It finally fit the purpose of SO. In my opinion. – Louis Lecocq Commented Jun 7, 2016 at 10:37
3 Answers
Reset to default 4Your situation
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.
Better solution
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.
本文标签: javascriptNodejsnpmnode Package differenceStack Overflow
版权声明:本文标题:javascript - Nodejs, Npm, node. Package difference? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1744953249a2126109.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论