I have tried so far installed node.js and npm via
sudo apt-get install nodejs
and sudo apt-get install npm
. Then I tried typing node on bash nothing happens, I tried using node app.js
nothing happens to no error
I have tried so far installed node.js and npm via
sudo apt-get install nodejs
and sudo apt-get install npm
. Then I tried typing node on bash nothing happens, I tried using node app.js
nothing happens to no error
From our discussion here
After installing node.js
and npm
Create a symbolic link for node:
sudo ln -s /usr/bin/nodejs /usr/bin/node
Now verify commands working with
node -v
npm -v
Run it by using,
node hello.js
In order to test the application, open another terminal session and connect to your web server. Be sure to substitute in the app server's private IP address for APP_PRIVATE_IP_ADDRESS, and the port if you changed it:
curl http://APP_PRIVATE_IP_ADDRESS:8080
reference here
The node
package that you installed when you ran sudo apt-get install node
is not actually NodeJS. Instead, the node
package actually predates NodeJS and installs Amateur Packet Radio.
The package you are looking for is actually nodejs
. However, installing nodejs
on Ubuntu will give you an outdated version of NodeJS. Alternatively, you can install NodeJS using a PPA or from Node Version Manager (nvm).
I've posted a comparison of the different installation methods with pros and cons. My personal preference when installing Node on an Ubuntu development machine is to install using NVM. If you're installing NodeJS on a production server, you'll be better off following instructions from Nodesource.