Difference between node and nodejs - node.js

I know this is something confusing. but
node --version
v5.2.0
and
nodejs --version
v0.10.25
gives different versions? What is the difference between them?

You probably installed node as a not-clean installation, and instead of upgrading the node version on your computer, you've added a different version and kept the old one.
Installing 32bit/64bit versions might explain this as well.
If you want to get everything in order, go to Add/Remove programs, remove all your node versions, make sure nothing is left in Program Files / Program Files (x86) and install a clean installation.

Usually, you have NodeJS once not twice like you.
I recommend you to uninstall and retry a clean install: https://nodejs.org/en/

Related

How do I know which version of node.js I am currently running?

I remember I have upgraded to node.js v8.0.0.
And when I type node --version I see version number is v8.0.0.
However when I use which node on my OS X I see the path is /usr/local/Cellar/node/7.7.1/bin/node. Why would that happen? Am I using v8.0.0?
How did you install node?
Seems like you have used brew to install node in the past, but then upgraded in some other way.
In any case, you should trust the node --version, since this is node itself reporting.
If still in doubt, I would remove and reinstall.
Sounds like you have installed one version with Homebrew and one by normal installer?
Depending on your setup you can either remove the 7x version from Homebrew, or update and link to the correct version in Homebrew.
https://github.com/Homebrew/brew/blob/master/docs/FAQ.md#can-i-install-my-own-stuff-to-usrlocal

Windows 10, how to upgrade node from 0.10.26 to latest (6.10 or 7.7.1)

The official node documentation says just run the installer from the latest version and it will overwrite the old version. It doesnt in my case for some reason.
node --version
gives 0.10.26.
I downloaded and installed 6.10.0 LTS from the node site.
node --version still gives 0.10.26 (including after reboot)
I have read many posts on the subject, and other people suggest
npm install update
this downloads some files, but node --version still gives 0.10.26
In add-remove programs, there is only 6.10.0, no 0.10.26, so dont know how to uninstall this old version.
Any ideas where I can get an uninstaller from, or how to manually uninstall the old version?
Note, I dont want to complicate things with one of the many tools for managing multiple versions of node as this is likely to add more complexity and problems, I just want to get the latest node if that is possible.
Searching my hard drive, i found there is nodejs installed in program files. Its not easy to know what version this is, but the CHANGELOG.md says version 3.1.0. I have no idea where 0.10.26 is installed to, nor 6.10 for that matter.
I cant see anything like NODE_HOME in my env vars, but c:\programfiles\node\nodejs is in the PATH. Although add-remove programs tells me 6.10 is installed, I dont see how or where, or how to uninstall 0.10.26
Any ideas?
=== update ====
To make it even more confusing, I tried CDing into c:\program files\nodejs and ran "node.exe --version" This DOES give 6.10.0. So the only version of node which seems to be on the machine, and the one my path points to, is 6.10, but when I run "node --version" in any other directory, I get 0.10.26.
Well, by luck, I found the problem. I went through every item in my path and found something called baboonstack, which I had never heard of. Uninstalled that, and get 6.10.0! Good times!

How to understand the difference of edition in NodeJS? [duplicate]

I installed Node JS several months ago and played around a bit. Today, I wanted to start learning more about node and before coding, I decided I wanted to make sure I had the latest version.
I checked the version and it was something like v0.10.3x. I looked on the NodeJS website and it shows the latest version as v4.1.0. So I thought Woahhh! I better upgrade and I couldn't believe it moved that fast to a 4.x version in only a few months.
I spent quite some time trying to figure out how to completely uninstall node and npm because I couldn't seem to upgrade it.
Finally I got it all ripped out, then installed in on CentOS 7 using yum. I know I won't get the latest version through yum but, I figured it would be close enough.
After install, I am at v0.10.40.
I have a feeling I just don't understand something about NodeJS version numbers.
Yeah if you only used the official node.js runtime then it would have appeared to jump from 0.12.x all the way to 4.0.0 in one fell swoop. What you may not have known was that node devs that were sick of how much the node repository was stagnating made a fork of the project and called it io.js. Under the io.js name the project marched forward over the last six months or so; it started at v1.x and iterated all the way through 2.x and 3.x in that time. Old node.js used a different versioning system wherein the odd versions were unstable and even versions were stable. Io.js switched to using semver versioning semantics like packages on npm already use.
After a lot of deliberation Joyent (original maintainers of node.js) finally caved in and helped form a proper open committee around node in an effort to push the project forward in much the same way io.js was already doing. A few months ago they agreed to merge io.js back into node.js (which was the goal of those who created io.js in the first place). They finally finished merging the two projects recently. The name io.js is no more and node.js lives on starting at v4.0. It will continue to use semver semantics like io.js did :)
Going forward things with node will be MUCH simpler. I'm excited to see where the project goes from here.
That is because since v4.0, the Node.js project and the io.js project that are now combined.
As for the io.js project, the version numbers were like v3.x, v2.x and v1.x.
Reference https://nodejs.org/en/blog/release/v4.0.0/
You can use NVM(Node Versioning manager) for avoiding confusion.
Benefit of this package is you can switch b/w two versions according to your convenient. Its a very easy to use tool.
https://www.liquidweb.com/kb/how-to-install-nvm-node-version-manager-for-node-js-on-ubuntu-12-04-lts/
if you use npm you can upgrade with
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
once done try node -v to see what you got
see more at http://davidwalsh.name/upgrade-nodejs
You can update node or npm using command line. You need to have a version of node or npm installed in your machine.
Use the following command in you terminal.
npm install node -g
npm install npm
You can also install the specific version of node, Like this.
npm install node#8.1.3
npm install npm#4.1.2
Here 8.1.3 is a version number. Use any of the version you want to install.

NodeJS version number confusion

I installed Node JS several months ago and played around a bit. Today, I wanted to start learning more about node and before coding, I decided I wanted to make sure I had the latest version.
I checked the version and it was something like v0.10.3x. I looked on the NodeJS website and it shows the latest version as v4.1.0. So I thought Woahhh! I better upgrade and I couldn't believe it moved that fast to a 4.x version in only a few months.
I spent quite some time trying to figure out how to completely uninstall node and npm because I couldn't seem to upgrade it.
Finally I got it all ripped out, then installed in on CentOS 7 using yum. I know I won't get the latest version through yum but, I figured it would be close enough.
After install, I am at v0.10.40.
I have a feeling I just don't understand something about NodeJS version numbers.
Yeah if you only used the official node.js runtime then it would have appeared to jump from 0.12.x all the way to 4.0.0 in one fell swoop. What you may not have known was that node devs that were sick of how much the node repository was stagnating made a fork of the project and called it io.js. Under the io.js name the project marched forward over the last six months or so; it started at v1.x and iterated all the way through 2.x and 3.x in that time. Old node.js used a different versioning system wherein the odd versions were unstable and even versions were stable. Io.js switched to using semver versioning semantics like packages on npm already use.
After a lot of deliberation Joyent (original maintainers of node.js) finally caved in and helped form a proper open committee around node in an effort to push the project forward in much the same way io.js was already doing. A few months ago they agreed to merge io.js back into node.js (which was the goal of those who created io.js in the first place). They finally finished merging the two projects recently. The name io.js is no more and node.js lives on starting at v4.0. It will continue to use semver semantics like io.js did :)
Going forward things with node will be MUCH simpler. I'm excited to see where the project goes from here.
That is because since v4.0, the Node.js project and the io.js project that are now combined.
As for the io.js project, the version numbers were like v3.x, v2.x and v1.x.
Reference https://nodejs.org/en/blog/release/v4.0.0/
You can use NVM(Node Versioning manager) for avoiding confusion.
Benefit of this package is you can switch b/w two versions according to your convenient. Its a very easy to use tool.
https://www.liquidweb.com/kb/how-to-install-nvm-node-version-manager-for-node-js-on-ubuntu-12-04-lts/
if you use npm you can upgrade with
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
once done try node -v to see what you got
see more at http://davidwalsh.name/upgrade-nodejs
You can update node or npm using command line. You need to have a version of node or npm installed in your machine.
Use the following command in you terminal.
npm install node -g
npm install npm
You can also install the specific version of node, Like this.
npm install node#8.1.3
npm install npm#4.1.2
Here 8.1.3 is a version number. Use any of the version you want to install.

How to upgrade node.js on Windows?

I already have Node.js v0.8.0 running on Windows. Can I just run the latest installer to upgrade it to v0.8.4? I am afraid it will break existing third party modules on my machine.
Yes, you just install the latest version. Generally you shouldn't have any compatibility problems if you are already using the same major version (e.g. Version 0.8.x). If you are concerned about changes, you can always check the changelog for each version (link to changelog is on node.js download page at nodejs.org). That should tell you of any big changes (i.e API changes, etc).
For the record, I have just gone through the process, and it is painless even if you upgrade to another major version.
I have moved from 0.8 to 0.10, using the .msi package, overwriting the one installed on my system. Package problems were all fixed with npm update -g. Worked like a charm.
In case it does not work like a charm:
npm cache clean usually fixes the problem. Once the cache is empty, just run npm update -g again.
In case you really run into trouble:
Delete the modules you have installed globally, then reinstall them. Here's how:
Take stock of what you have:
npm list -g --depth=0 lists all top-level packages, with version numbers.
npm list -g --parseable --depth=0 > npm-global-modules.txt writes them to a file in your cwd.
Any strange stuff you didn't install yourself has probably been installed by another module (rare, but I have seen it happen). Remove those modules from the list. Also remove the module "npm".
In an editor, format the output for the command line by replacing \n?[^\n]+[\\/] (regex) with a single space.
(I didn't get this to work with findstr in a pipe, hence the roundtrip to the editor. You can also do it manually, of course ;)
Delete all modules. On Windows, delete (or rename) the %appdata%\npm directory. For other OS, see Command to remove all npm modules globally?
Reinstall the modules with npm install -g [your module list here]. Don't forget to npm cache clean before you do it.
I don't have experience with node on Windows, but I have just upgraded node & modules on my Mac, so this is just a general answer:
If you install v0.8, you might break your existing node modules, if they use deprecated functions, etc. The problem is that npm only checks your version of node while modules are being installed, not at run-time.
To be on the safe side, you need to find the global node_modules folder on your machine, back it up to somewhere, then delete and reinstall the modules. You will need to do the same thing for the node_modules folders in the apps you are using. (Assuming you have package.json files, reinstalling these should be easy.)
In practice, I don't think any of the modules I was using were actually incompatible. Good luck.
Yes. You can upgrade your node.js version to the latest by running the installer for latest node.js version at https://nodejs.org/en/. I upgraded mine from 4.4.4 to 8.11.2 running the installer.
Unless you're using a module that relies on an actual bug that was present in 0.8.0 and was fixed by 0.8.4, you're OK. There were no API changes in between those two versions (and the node team is too smart to introduce such changes in a minor release).
Currently upgrading to 4.4.*. I just used to installer from the nodejs.org website and that upgraded everything works just fine.
Just go to nodejs site & download it. You can install it directly without any hesitation. If you have any dependency on earlier version then check change logs.
JUST GO TO
nodejs.org
INSTALL THE LATEST STABLE VERSION (Recommended For Most Users)
and then run
npm install node
Now, you are good to go
You can even check the version of NodeJS using command
node --version
Best way to install node on windows is by using nvm-windows, so you can quickly switch between versions if you need to. This is analogous to the best way of installing node on linux and max, ie with nvm.
But Benjen is right (how could he not be with all his scouting experience) that you can just install a different version of node, and your version will update. Your npm dependencies may have to be reinstalled, and any extensions that aren't managed by npm may need to be recompiled, but this will be true no matter how you change your node version.

Resources