This is just a simple tutorial. Just trying to improve my writing skill
If you are MEAN stack developer, you must be already know what is NVM. For beginner learning NodeJS languange, I suggest you to use NVM (NodeJS Version Manager) instead installing specific version on you computer. Because with version manager, it much easier, robust and cleaner than the normal method we used for. Give it a try!
I am using Fedora 30 and I would like to share how to install NodeJS ontop of NVM. First of all, the current version of NVM are v034.0. You may check on github for the latest version.
Fire up your terminal and type $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
You will get something like this:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13226 100 13226 0 0 22531 0 --:--:-- --:--:-- --:--:-- 22493
=> Downloading nvm from git to '/home/rnm/.nvm'
=> Cloning into '/home/rnm/.nvm'...
remote: Enumerating objects: 278, done.
remote: Counting objects: 100% (278/278), done.
remote: Compressing objects: 100% (249/249), done.
remote: Total 278 (delta 33), reused 88 (delta 16), pack-reused 0
Receiving objects: 100% (278/278), 142.36 KiB | 121.00 KiB/s, done.
Resolving deltas: 100% (33/33), done.
=> Compressing and cleaning up git repository
=> Appending nvm source string to /home/rnm/.bashrc
=> Appending bash_completion source string to /home/rnm/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:
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
Close the current terminal and reopen the terminal. To make sure the export path is updated.
Check you NVM version installed on you computer:
$ nvm --version
0.34.0
To download, compile, and install the latest release of node, do this $ nvm install node # "node" is an alias for the latest version
Downloading and installing node v12.4.0...
Downloading https://nodejs.org/dist/v12.4.0/node-v12.4.0-linux-x64.tar.xz...
########################################################################################################################################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v12.4.0 (npm v6.9.0)
Creating default alias: default -> node (-> v12.4.0)
So we have installed node right now
$ node --version
v12.4.0
$ nvm run node --version
Running node v12.4.0 (npm v)
v12.4.0
$ nvm which 12.4.0
/home/rnm/.nvm/versions/node/v12.4.0/bin/node
To install a specific version of node:
$ nvm install 6.14.4 # or 10.10.0, 8.9.1, etc
The first version installed becomes the default. New shells will start with the default version of node (e.g., nvm alias default).
You can list available versions using ls-remote:
$ nvm ls-remote
And then in any new shell just use the installed version nvm use node
or you can just run it nvm run node --version
Or, you can run any arbitrary command in a subshell with the desired version of node nvm exec 12.4.0 node --version
You can also get the path to the executable to where it was installed nvm which 12.4.0
Top comments (0)