Cannot run npm install on ubuntu - node.js

node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
Above is the error I get when running npm install on ubuntu. I have node version 16.13.2 and ubuntu is version 18.04.
I tried adding following to package json but it did not work.
{
"engines": {
"node": ">= 16.13.2"
},
I also tried the following on ubunutu command line
sudo apt-get update
sudo apt-get install libc6
but, it did not work. It says I have the latest version already that is, 2.27-3ubuntu1.5 but the error mentions 2.28 is required. Cannot find how to update.

Maybe you are using latest version of node (18.0.0) . It created same error for me .
Use node js stable release or the version you are sure that will work.you can use n to install various nodejs verson.
you can install n using npm sudo npm i -g n after that run
sudo n stable or sudo n <node version you needed>

Related

Installing latest version of npm on Ubuntu 14.04 (trusty)

I have
a remote serving running Ubuntu 14.04. I used apt to install node
a local OSx machine running El Capitan. I used hombrew to install node.
This results in the following.
Ubuntu 14.04
> sudo apt-get update
> sudo apt-get install node nodejs npm
> npm --version
1.3.10
> node --version
(emtpy)
> nodejs --version
v0.10.25
OSx
> brew install node
> npm --version
5.6.0
> nodejs --version
-bash: nodejs: command not found
> node --version
v8.11.3
Why are the apt repositories so out of date? The npm version on the server (1.3.10) is 4 versions behind that of OSx machin (5.6.0).
This npm issue even mentions that the apt repositories are quite old / not updated.
Is there a way to install a more recent version of npm on the Ubuntu server?
Download this tar file from nodejs official website
https://nodejs.org/dist/v8.11.4/node-v8.11.4.tar.gz
download, untar and install it via using the following command
sudo make test
sudo make install
It will install 8.11.4 version.
Please note that you can download any version of tar from nodejs officail page and can install it on your Ubuntu server and by using this method you don't need to update your apt packages.

Error when I try to install npm on Ubuntu 17.04

I'm trying to install npm on Ubuntu 17.04 but I'm not getting it. I've installed nodejs and nodejs-legacy and when I try to install npm, a message appears saying that npm depends on node-gyp (>= 0.10.9) and won't be installed. If a try to install node-gyp, another dependency appears and successively. Does anybody know how to fix it?
if you use apt-get for install nodejs you can switch version easily:
$ sudo apt-get install npm # install npm
$ sudo npm install -g n # install n nodejs version switcher as global package.
$ sudo n stable # install latest stable version.
install more version: [exmp: 9.1.0]
$ sudo n 9.1.0
reference
I suggest you don't use apt-install to install npm.You can download the bin file from official site.(https://nodejs.org/en/)
Just extract the tar file and setup the path to you system,you can get the latest version!

Error: npm is known not to run on Node.js V4.2.6

how can I solve the following error? I use Ubuntu 16.
When I run any npm command such as "npm run dev" I get this error:
ERROR: npm is known not to run on Node.js v4.2.6 Node.js 4 is
supported but the specific version you're running has a bug known to
break npm. Please update to at least ${rel.min} to use this version of
npm. You can find the latest release of Node.js at https://nodejs.org/
First, Uninstall completely nodejs and npm.
sudo apt remove nodejs npm
Then, reinstall it over the link below:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
Refer: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
You can try downgrading the node version to switch from the bugged version using the following, upgrading also works if your app supports latest versions.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash
nvm install 4.2.5
nvm use 4.2.5
//check with
node -v
//To uninstall a node version
nvm uninstall 4.2.6
I just had this issue on Ubuntu 16. Use n to update to the latest version
sudo n latest
That should settle it.
I download latest install package from https://nodejs.org/en/ and reinstall it. Solve it!
You can also use NVM - I did this to solve the same problem.
first type
nvm ls-remote to view the latest versions available,
then
nvm install [version] (I used v8.7.0)
everything should be fine after that.
I had a similar problem but my project is part of a bigger system so neither switching to nvm instead of npm nor upgrading my version of Node.js were options.
However, moving npm backwards to a previous version was an option. I found 4.6.1 worked without complaint.
sudo npm install -g npm#4.6.1
This version of npm did not complain.
I fixed the same issue with Ubuntu 16.04 by using following commands step by step.
Uninstall nodejs and install version 8.0
$ sudo apt remove nodejs npm
$ curl -o-
https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
$ nvm install 8.0
$ nvm use 8.0
$ node -v
v8.0.0
Get latest release with
$ nvm install node
Then run the following
$ nvm alias default stable_node_version

Node.js will not Update to Latest Version

I currently have node.js version v7.6.0
According to documentation, v8.5.0 is the latest version of node.
I have tried installing it using https://nodejs.org/en/
node -v returns v7.6.0.
I have tried the following commands in Terminal:
[sudo] npm install npm#latest -g
npm install npm#latest -g
sudo apt-get update
sudo n 0.8.21
sudo n latest
lsb_release -a
Each command appears to recognize and install the latest version, but the final message reads:
Installed: v7.6.0
I've altered my BASH Profile to include:
/usr/local/bin/node
/usr/local/bin/npm
My version still shows v7.6.0 as the current version running.
Side Note:
My NPM is up-to-date at version 5.4.2
Is there any other way to update my Node to the current version?
In order to update to the latest version of node, use commands:
nvm use system
nvm run system --version
nvm install node
These commands will bring you to the latest version of node.
Thank you!

Reinstalling node.js is throwing error

I had node 6 before but I had to remove it to downgrade it to Node 4. But when I am trying to reinstall node 6/ install node 4, I am getting this error.
[root#vvvvvv xxxxxxx]# yum install -y nodejs
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Package 2:nodejs-6.11.0-1nodesource.el7.centos.x86_64 already installed and latest version
Nothing to do
I used this to remove the previous version.
after this, as per another website source, I tried
sudo rm -fv /etc/yum.repos.d/nodesource*
but to no avail!!
When I am checking $node --version or $npm --version, I dont get any valid output.
To install Node.js I would recommend using your package manager (yum):
yum install -y nodejs
Once you have nodejs and npm installed successfully on your machine, I would then use a Node version manager (I personally use n, but nvm works as well) to install a specific version:
npm install -g n
Then use your Node version manager to install a specific Node version:
n 4
NOTE: This command above will install the latest version of Node.js 4 (which at this time is 4.8.3). If you need a specific version you can specify it instead of just n 4. To see all available versions you can use the n ls command
You can verify your version of Node and npm using the --version flags as you were doing before

Resources