Node not installed after installation - node.js

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

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.

Node.js Command line does not execute

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?

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

Updating to Node 4.x in linux(ubuntu) fails with no error and stays with v0.10

I have come across ReactJS and React Native. ReactJS is brilliant, super fast and works fine on Node v0.10. But, React Native needs v4.x as a prerequisite.
So, when I run any react-native command, it fails and says Node 4 is required.
I have tried several times and many ways to update Node, but, have failed.
First followed Installation Instructions -
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash
sudo apt-get install -y nodejs
I ended up with the following message-
root#purvotara:/# apt-get install -y nodejs
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 0 not upgraded.
Then, there was Manual Installation way of installing.
add-apt-repository -y -r ppa:chris-lea/node.js
rm -f /etc/apt/sources.list.d/chris-lea-node_js-*.list
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
echo 'deb https://deb.nodesource.com/node/dists/trusty/Release main' > /etc/apt/sources.list.d/nodesource.list
echo 'deb-src https://deb.nodesource.com/node/dists/trusty/Release main' > /etc/apt/sources.list.d/nodesource.list
apt-get update
apt-get install nodejs
Still, ended up with -
nodejs is already the newest version.
I tried to purge and auto-remove my current v0.10 node and tried to freshly install, not sure if its still picking the install from the cache, but, v0.10 got installed.
Also followed linoxide article on the same. A .configure and make install didn't seem to work as well.
What am I doing wrong? I am stuck for hours.
Went over several other links to resolve other issues(they are resolved now)-
Uninstalling node
Failed to fetch Trusty
Use n. npm install -g n
then you can switch to any version of node using a command like this n v4.1.2
https://www.npmjs.com/package/n
n uses /usr/local/bin/node for n to work properly on debian based systems, create a symlink to point to this directory.
sudo ln -s /usr/local/bin/node /usr/bin/node
#Holger This was the result of using 'n'.
I have added this as an answer, as I want to bring more clarity in the code and solution itself.
Still facing the same problem.
I installed 4.2.1, but, v0.10 is being shown.
root#purvotara:/# n 4.2.1
install : node-v4.2.1
mkdir : /usr/local/n/versions/node/4.2.1
fetch : https://nodejs.org/dist/v4.2.1/node-v4.2.1-linux-x64.tar.gz
installed : v4.2.1
root#purvotara:/# n
root#purvotara:/# node -v
v0.10.25
I used NVM and the issue is solved.
You can Do it Two ways. First try second step It must work for you.
1 Uninstall First version and Reinstall Other one 4.1.2 is latest as per my knowledge.
2 Click Here Follow steps.
sudo apt-get update
sudo apt-get install build-essential libssl-dev
curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
source ~/.profile
nvm ls-remote
nvm install 4.*.* // Latest version choose here
nvm use 4.*.* // Latest version also here
node -v // Check your version

Resources