Starting off with MEAN stack— Installing nodejs On Linux Mint
NodeJs, a member of the MEAN stack is the JavaScript Runtime Environment that I needed to install before I start developing a demo app on top of the MEAN stack.
I easily keep forgetting the steps, the troubles I had to go through when installing such softwares. Just to remind myself of that, and also to fall back to it when I would want to reinstall it, here are the steps :-
- Go to https://nodejs.org/en/download/ and click on your type of thing (depending on whether 32bit or 64bit, the OS you are on, etc)
2. Open up the Terminal and cd to Downloads folder (or to the folder where you had downloaded the binaries; Downloads, in my case.)
cd ~/Downloads
3. Now, extract the downloaded file (in .tar.xz format in my case) to a target location using the tar command.
tar -xvf <file name>
(This created a new folder and extracted the files into it, in the same directory, Downloads)
4. Since the folder has been decompressed, now all we need to do is add node to the environment variables (adding to the PATH) so that when we type ‘node -v’ or ‘npm -v’, it recognizes and prints out the version. ( Just a way to confirm that nodejs has been successfully installed)
(npm, by the way is node package manager which downloads and installs packages needed for development for supported JavaScript environments. but it does more than just that (version management and dependency management)
Creating a symlink
sudo ln -s /usr/local/node-v4.3.1-linux-x86/ /usr/local/node
(node-v4.3.1-linux-x86 is the folder to which node files were extracted to)
(in this case, you will have to add /usr/local/node path to your environment/PATH variable. That can be done by opening/creating ~/.bashrc file and adding this -
PATH=$PATH:/usr/local/node/bin
Save and Close. Restart the terminal and type ‘node -v’ to check if it shows the version. If it does, nodejs has been installed on your machine.
(Trouble shooting : If it doesn’t show up, type echo $PATH to check whether the path has been added)