0

I have installed node using sudo apt-get install node.

linux@linux:~$ node -v
linux@linux:~$

linux@linux:~$ npm -v
1.3.10
linux@linux:~$ 

I also download node from https://nodejs.org/en/ but, I don't find the full installation manual.

alhelal
  • 2,621

1 Answers1

2

The Node.js executable is installed to /usr/bin/nodejs and the command to show the Node.js version is:

nodejs -v  

Instead of installing the Node.js apt package with sudo apt install nodejs I recommend installing the more up-to-date Node.js snap package with sudo snap install node by following the instructions in this answer.

karel
  • 114,770
  • @SurajRao node -v is the command for showing the Node.js version for the Node.js snap package. For showing the Node.js apt package version see this answer: https://askubuntu.com/questions/594656/how-to-install-the-latest-versions-of-nodejs-and-npm – karel May 19 '18 at 05:54
  • Yeah . You are right.. actually https://askubuntu.com/questions/404929/node-command-not-found explains it... Sorry.. Ubuntu has some package name issue – Suraj Rao May 19 '18 at 05:56
  • The reason for this discrepancy is that it is possible to install the Node.js snap package and the Node.js apt package alongside each other, and still be able to check the versions of each package in an unambiguous way. btw Your duplicate comment below the question is correct. The question is a legitimate duplicate of How to install the latest versions of NodeJS and NPM? – karel May 19 '18 at 06:02
  • that makes sense.. But for people who want to maintain multiple node installations, it is recommended to use nvm. – Suraj Rao May 19 '18 at 06:04
  • nvm is now unnecessary if the Node.js snap package is installed. Users can switch between versions of Node.js at any time without needing to involve additional tools like nvm (Node Version Manager), for example: sudo snap refresh node --channel=8/stable It's a great feature, you can have multiple Node.js versions installed alongside each other with the Node.js snap package, and select which version of Node.js to use for each project. – karel May 19 '18 at 06:05