So I get this error when doing apt-get upgrade
Setting up nodejs (0.10.30-1chl1~trusty1) ...
update-alternatives: error: alternative link /usr/bin/node is already managed by nodejs
dpkg: error processing package nodejs (--configure): subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing: nodejs
E: Sub-process /usr/bin/dpkg returned an error code (1)
NB: "nodejs --version" works, I get a clean "v0.10.30" but "node --version" doesn't since there is no link.
So far, I have tried:
complete removal of nodejs & new install
I manually removed the link /usr/bin/node to nodejs after removing nodejs, since it was still there and the issue is related to update-alternatives
using "update-alternatives --config nodesjs" (something was broken and repaired the first time I used it, but it didn't solve the issue. That error has not reappeared since).
Other answers didn't resolved the problem on my setup, maybe because I was using the NodeSource repository instead of the official ones.
But I've simply removed all "alternatives" for the nodejs group first:
sudo update-alternatives --remove-all nodejs
And after that, a sudo apt-get install nodejs just worked.
I really encourage you to use nvm to install Node.js on your ubuntu machine (https://github.com/creationix/nvm). With that, the installation of any Node.js version becomes very easy.
Probably you have an older version of NodeJS installed and you get a conflict while upgrading.
The only package that uses /usr/bin/node is nodejs-legacy, so unless you have created that link by yourself or installed NodeJS from sources that's the package you need to remove:
$ sudo apt-get purge nodejs-legacy nodejs
After that just reinstall NodeJS, update and upgrade your software:
$ sudo apt-get install nodejs
$ sudo apt-get update && sudo apt-get upgrade
From the output you gave the NodeJS version from the PPA has priority over the other, so you should not have any problem installing it.
Related
I need at least any >14 version of node, but when i tried to update i had to uninstall. now i1m trying to install the 16 version but i keep gettimg this error:
Unpacking nodejs (16.19.0-deb-1nodesource1) ... dpkg: error processing
archive
/var/cache/apt/archives/nodejs_16.19.0-deb-1nodesource1_amd64.deb
(--unpack): trying to overwrite '/usr/include/node/common.gypi',
which is also in package libnode-dev 12.22.9~dfsg-1ubuntu3 dpkg-deb:
error: paste subprocess was killed by signal (Broken pipe) Errors were
encountered while processing:
/var/cache/apt/archives/nodejs_16.19.0-deb-1nodesource1_amd64.deb E:
Sub-process /usr/bin/dpkg returned an error code (1)
To install NodeJS Firstly make sure to update your packages
sudo apt update
sudo apt upgrade
Then make sure to have curl installed, sudo apt install curl -y
Then import NodeJS repo by curl -fsSL https://deb.nodesource.com/setup_NODEJS_VERSION | sudo -E bash -
Make sure to change NODEJS_VERSION to the version u wish to install, for example if u want to instal v16 change it to 16.x then simply run sudo apt install nodejs -y to install nodejs
Hope that helped!
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.
I moved from windows to ubuntu and following the instruction as per the site - https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
Following comand ran successfully
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
Then
sudo apt-get install -y nodejs
The output of the above command is :
$sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version (4.2.6~dfsg-1ubuntu4.1).
0 upgraded, 0 newly installed, 0 to remove and 519 not upgraded.
As you can see its taking nodejs of version 4 , although I trying to install 8+
I removed the nodejs with
sudo apt-get remove nodejs
but still on trying again it says the same thing.
Please note that the setup is new and there was nothing installed previously
I am not sure but I wanted 'node', why its trying to install nodejs
If I try to do this -
$ sudo apt-get install node
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package node is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'node' has no installation candidate
Hey I use Ubuntu 16 the latest LTS
What you can do, is install ubuntu-make
Then run
umake nodejs
It installs the latest version available (v8.2.1)
Or, you can also use nvm
The detailed instructions are here
Note If you use ubuntu-make , you may have to log out and log in
Then check your version via node -v
Once you have version 4, you can update it to the latest. See this topic Upgrading Node.js to latest version
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
I had Node.js installed on my server. Yesterday, I deleted it with yum erase nodejs and now I'm trying to install the new Node.js. I've tried yum install nodejs-compat-symlinks npm but it ends with the error:
Running rpm_check_debug
Running Transaction Test
Transaction Check Error:
file /usr/bin/node conflicts between
attempted installs of nodejs-compat-symlinks-1-1.el6.noarch and
nodejs-0.10.5-3.el6.x86_64
file /usr/include/node conflicts between
attempted installs of nodejs-compat-symlinks-1-1.el6.noarch and
nodejs-devel-0.10.5-3.el6.x86_64
How I may install Node.js on server now?
P.S. I installed Node.js with this manual:
wget
http://patches.fedorapeople.org/oldnode/repocfg/el/nodejs-stable-release.noarch.rpm
yum localinstall --nogpgcheck nodejs-stable-release.noarch.rpm
Edit /etc/yum.repos.d/nodejs-stable.repo. Comment out the mirrorlist
and use for [nodejs-stable] the baseurl:
baseurl=http://patches.fedorapeople.org/oldnode/stable/el$releasever/$basearch/
and for [nodejs-stable-source] also comment out the mirrorlist and use
for [nodejs-stable-source] the baseurl:
baseurl=http://patches.fedorapeople.org/oldnode/stable/el$releasever/SRPMS/
It looks like you have a conflicting package that you didn't erase with Node when you ran yum erase nodejs. nodejs-devel-0.10.5-3.el6.x86_64 is a completely separate package.
http://pkgs.org/centos-6-rhel-6/epel-testing-x86_64/nodejs-0.10.9-1.el6.x86_64.rpm.html
http://pkgs.org/centos-6-rhel-6/epel-testing-x86_64/nodejs-devel-0.10.9-1.el6.x86_64.rpm.html
Try running yum erase nodejs-devel, and then try to yum install nodejs-compat-symlinks npm again.