NodeJS is already installed but won't run - node.js

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

Related

Getting python2 error in nodejs installation in Ubuntu 20.04

I've updated to the new Ubuntu 20.04LTS version and all my node installations have gone. So to install node I have tried the following 2 methods:
1.sudo apt update
sudo apt install nodejs npm
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install nodejs
While installing nodejs I'm getting the error : nodejs : Depends: python2-minimal but it is not installable . Unable to correct problems, you have held broken packages.
screenshot
You need to install python2. Steps in Ubuntu 20
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install python2
This will install python2 successfully. Now you can continue with normal nodejs installation
I had a similar problem and solved it by following the instructions on https://speedysense.com/install-nodejs-on-ubuntu-20-04/
Tldr run these on a terminal: for current LTS Release (v14.x),
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Afterwards check your Nodejs and npm version by running these on a terminal:
node --version
npm --version

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?

How To Install Node Js In Ubuntu 18.10?

i'm trying to install nodejs in Ubuntu 18.10 but it returns some error.
The following packages have unmet dependencies:
nodejs : Depends: python-minimal but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Above is the message i get while install node Js by cammand: sudo apt-get install nodejs.
As described in this link:
Install node version manager:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
Activate nvm:
. ~/.nvm/nvm.sh
Use nvm to install the version of node you want:
nvm install 4.4.5
Test that Node.js is installed:
node -e "console.log('Running Node.js ' + process.version)"
The recommended way to install node under Ubuntu appears to be to use the archives provided by NodeSource.
Their instructions are to run these shell commands to, presumably, set up a PPM and install a current version of node from that source.
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
First you need to install python 2.7 using following commands
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python2.7
then install nodejs
sudo apt-get install nodejs
Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_15.x | sudo -E bash -
sudo apt-get install -y nodejs
Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_15.x | bash -
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

I can not install the nodejs 6 on ubuntu

At first I installed the node with terminal, with command
Update Package Manager
sudo apt-get update
Adding NodeJS PPAs
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
Installing NodeJS and NPM
sudo apt-get install nodejs
It works, but when I am looking version node, I see node v 4
Then I used google for search this problem and a found this topic
https://stackoverflow.com/a/43914369
There using a ln command for create symbolic link between two files
and used this instruction for manual install, but nothing happens, error appears and not installing
Look at this screenshot
Maybe I doing anything wrong?
I tend to avoid using my operating system's package manager to install node. The easiest way to install node is Node Version Manager.
Yeah! The solutions found in official site
Of course link Install node version 6
Can you please check:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
but for this you need curl to be installed.
sudo apt-get update
To install curl: sudo apt-get install curl
Here's the link for this.
To upgrade node to latest version: https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version#480642

Resources