npm not installed along with nodejs
Version: v4.2.6 of node -v Platform: Linux 4.8.0-36-generic #36~16.04.1-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux.
Following the guidelines as per https://nodejs.org/en/download/package-manager/, installed nodejs versin-7.x on my machine several times.
But every time npm does not get installed. When typing in 'npm -v' it says, the program 'npm' is currently not installed. You can install it by typing: 'sudo apt install npm'.
What's even strange is, the system displays(node -v) that the installed nodejs version is v4.2.6.
have you seen this post: older versions could be throwing it off. http://www.hostingadvice.com/how-to/install-nodejs-ubuntu-14-04/
The details documented at https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions include : "A Node.js package is also available in the official repo for Debian Sid (unstable), Jessie (testing) and Wheezy (wheezy-backports) as "nodejs". It only installs a nodejs binary." You might want to check the repositories that are configured that apt-get consults and see if this last statement applied.
I've uninstalled both node and nodejs as per http://www.hostingadvice.com/how-to/install-nodejs-ubuntu-14-04/ and again installed nodejs as per https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions.
##Here's the log:#####################################
userName@userName:~$ sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libuv1
The following NEW packages will be installed:
libuv1 nodejs
0 upgraded, 2 newly installed, 0 to remove and 12 not upgraded.
Need to get 0 B/3 218 kB of archives.
After this operation, 13,4 MB of additional disk space will be used.
Selecting previously unselected package libuv1:amd64.
(Reading database ... 246235 files and directories currently installed.)
Preparing to unpack .../libuv1_1.8.0-1_amd64.deb ...
Unpacking libuv1:amd64 (1.8.0-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.1_amd64.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.1) ...
Processing triggers for libc-bin (2.23-0ubuntu7) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Processing triggers for man-db (2.7.5-1) ...
Setting up libuv1:amd64 (1.8.0-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.1) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu7) ...
#########################
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.1) ...
Why is that so?
######################### ##After installing this is what the terminal shows:####################
userName@userName:~$ which nodejs
/usr/bin/nodejs
userName@userName:~$ nodejs -v
v4.2.6
userName@userName:~$ npm -v
The program 'npm' is currently not installed. You can install it by typing:
sudo apt install npm
I'm sure that, curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -, installs version 7.x, but it always shows v4.2.6
have you tried, just typing in sudo apt install npm

I'm seeing the same issue on my Ubuntu VM. Running the instructions at https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions results in nodejs v4.2.6 getting installed without npm.
Try to update the nodejs version! It worked out for me!
After a hard time, I got npm installed with Carbon version. curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
The current version 10x did not work. curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
I made sure to purge the nodejs-legacy package from my debian 9 strech 32 bit machine.
After a hard time, I got npm installed with Carbon version. curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
The current version 10x did not work. curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
I made sure to purge the nodejs-legacy package from my debian 9 strech 32 bit machine.
Worked for me! Thanks.
this is still not working
techiepriyaranjan@techieace:~$ node -v
v8.10.0
techiepriyaranjan@techieace:~$ npm -v
Command 'npm' not found, but can be installed with:
sudo apt install npm
What to do? :disappointed:
this is still not working
techiepriyaranjan@techieace:~$ node -v v8.10.0 techiepriyaranjan@techieace:~$ npm -v Command 'npm' not found, but can be installed with: sudo apt install npmWhat to do? disappointed
Even I runned this command sudo apt install npm nothing is working :cry:
I found a possible source for the problem: debian is giving more priority to the oficial debian package.
#apt-cache policy nodejs
nodejs:
installed: 4.8.2~dfsg-1
candidate: 4.8.2~dfsg-1
table of versions:
8.12.0-1nodesource1 500
500 https://deb.nodesource.com/node_8.x stretch/main i386 Packages
*** 4.8.2~dfsg-1 900
900 http://deb.debian.org/debian stretch/main i386 Packages
100 /var/lib/dpkg/status
version 4.8.2 has more priority than version 8.12.0. To solve this I added this file /etc/apt/preferences.d/nodejs
Package: nodejs
Pin: origin deb.nodesource.com
Pin-Priority: 1001
this forces apt to consider packages from the deb.nodesource.com origines as higher priority than the Debian origin packages.
So it should select it as candidate after apt update and apt upgrade
amedranogil, Your solution worked! Problem solved on my end, in case the OP hasn't seen this.
Note, I installed the nodejs and npm package separately with the -y command after the suggested updates.
These steps helped me to get npm version getting listed, I hope this will help someone, https://stackoverflow.com/a/36856279/4146319
I got the same error today and it told me that Node was not properly linked and there were unexpected header files as well.
When I tried to reinstall node, It told me that it was already installed, just not linked.
Warning: /usr/local/include isn't writable
/usr/local/bin/node already exists. Remove it
Solution
To fix this, I took ownership of it by using:
sudo chown -R whoami /usr/local/
Then I force linked all files by using:
brew link --overwrite node
After that I did the post install routine with:
brew postinstall node
Then I checked if npm was properly installed with:
npm -v
I have Debian Stretch on 32-bit (i386) PC.
- Official Debian nodejs package is version 4.8.2 and it works via
nodejsorjscommands, but not bynodeornpmcommand -> "bash: node: command not found." - NodeSource 8.x or 6.x versions doesn't work. After install
nodeornpmcommand says "Illegal instruction"
I also need NPM. How to install it on 32-bit Linux system?
The following worked for me
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
and then
apt install npm
none of the above mentioned solutions worked for me. Any leads guys??
@nirajdevpandey try to remove nodejs, remove old npm(if it is), apt --autoremove apt update apt install nodejs
I got conflicts of manual installed npm and which comes with nodejs.
Hi,
I wounder if this has been resolved or not ?? what Os are you using to install node?? try to take a look at this link of how to properly install node https://cloudtails.blogspot.com/2019/05/how-to-install-latest-nodejs-npm-yarn.html if you still can't get it to work let me know. I'll be more than happy to assist you farther
Best Regards,
Jona.
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Fri, Jun 21, 2019 at 8:19 PM CrownlessX [email protected] wrote:
@nirajdevpandey https://github.com/nirajdevpandey try to remove nodejs, remove old npm(if it is), apt --autoremove apt update apt install nodejs
I got conflicts of manual installed npm and which comes with nodejs.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nodejs/help/issues/554?email_source=notifications&email_token=AA4BFJCN3IQTE47UBKA5V7TP3UETNA5CNFSM4DFQ4D22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYJB4CA#issuecomment-504503816, or mute the thread https://github.com/notifications/unsubscribe-auth/AA4BFJC6ZTX6OJFWQAKBYPTP3UETNANCNFSM4DFQ4D2Q .
root@ivan-Latitude-E6430:/home/ivan# apt install npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Oh I fixed it