Node.js Command line does not execute - node.js

I have a Ubuntu 18.04 Server, which I want install Node.js.
I execute following commands:
root#ubuntu:~# curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
root#ubuntu:~# apt-get install nodejs -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version (10.16.3-1nodesource1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root#ubuntu node -v
Command 'node' not found, but can be installed with:
apt install nodejs
root#ubuntu:~# which node
root#ubuntu:~# which nodejs
How can I solve this problem?

Related

nodejs latest version on my pc is not the latest

i was going to start use reactjs when but i had this :
create-react-app myapp
You are running Node 9.11.2.
Create React App requires Node 14 or higher.
Please update your version of Node.
i tried to update my node js by runing :
sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version (8.10.0~dfsg-2ubuntu0.4).
The following package was automatically installed and is no longer required:
libllvm6.0
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
My pc is 32 bit extensa 5635z
my os is lubuntu
any help please ?
To install the desired version of nodejs you can use the NodeSource Node.js Binary Distributions.
For Node.js v17.x:
# Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
sudo apt-get install -y nodejs

Command 'nodejs' not found, but can be installed with: sudo apt install nodejs in ububtu

installed node.js already but shows
Command nodejs not found, but can be installed with:
sudo apt install nodejs
then tried, sudo apt install nodejs
and shows
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version (14.13.1-deb-1nodesource1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
but when I try to check node.js version, $ nodejs -v
it shows, Command nodejs not found, but can be installed with:
sudo apt install nodejs
Please help me to solve this error and properly see node.js version
The nodejs executable is called node, please run node --version to see if your installation works.

NodeJS is already installed but won't run

I'm running Ubuntu 18 on my VPS server, and I'm trying to run NodeJS, however, this happens:
seth#vps186104:~$ nodejs -v
Command 'nodejs' not found, but can be installed with:
sudo apt install nodejs
seth#vps186104:~$ sudo apt install nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version (8.10.0~dfsg-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
seth#vps186104:~$
It says to install the package to run nodejs, however, trying to install nodejs it says it's already installed
What is going on?
Try running:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
Or if you want node 10.
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

Node not installed after installation

I installed nodejs using sudo apt-get, which appeared to continue perfectly.
If I now run sudo apt-get install nodejs it'll tell me:
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 113 not upgraded.
Yet, when I try to test node using node -v or node hello.js there is no reply. No error nothing.
How can I get it running?
Remove current nodejs package
sudo apt-get purge nodejs
and run the following command (node version 10)
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt update
sudo apt-get install -y nodejs
then check again
node -v

Nodejs install issue on ubuntu

I install nodejs using the following command on ubuntu
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
Then it gives this message,
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 253 not upgraded.
W: Duplicate sources.list entry https://dl.bintray.com/sbt/debian/ Packages (/var/lib/apt/lists/dl.bintray.com_sbt_debian_Packages)
W: You may want to run apt-get update to correct these problems
When I do "sudo apt-get update", I get another error,
W: Failed to fetch http://ppa.launchpad.net/chris-lea/node.js/ubuntu/dists/wily/main/binary-amd64/Packages 404 Not Found
W: Failed to fetch http://ppa.launchpad.net/chris-lea/node.js/ubuntu/dists/wily/main/binary-i386/Packages 404 Not Found
W: Failed to fetch http://ppa.launchpad.net/ole.wolf/rarcrack/ubuntu/dists/wily/main/binary-amd64/Packages 404 Not Found
W: Failed to fetch http://ppa.launchpad.net/ole.wolf/rarcrack/ubuntu/dists/wily/main/binary-i386/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Could you please let me know what how to correct that problem?
The errors occur because the four source links you (or some installer) added to your /etc/apt/sources.list are not found and return error 404.
If said entries are not in /etc/apt/sources.list, you can find them in some file /etc/apt/sources.list.d/*.list.
Delete the lines containing those urls in your /etc/apt/sources.list (or some file /etc/apt/sources.list.d/*.list) and install Node.js the official way:
https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
Or if you want version 6:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
Note
Maybe your running into that problem because your Ubuntu version is not supported.
I don't think they support 15.10, but only the LTS versions (14.04 & 16.04).
If you can, upgrade to 16.04 and try again.

Resources