npm installation not working under Debian Stretch
Solution 1
I have no idea why my tries from above did not work but for me installing nvm
like described here and then performing nvm install node
worked perfectly.
Solution 2
It seems as if it should be available in the npm
package but there's a problem:
Error: Package not available in this suite
I read somewhere that it's deliberately not available because there are so many outstanding security issues (with the packaged version). I solved my problem without any "sudo run this script from the Internet" solutions like this:
cd /tmp/
wget https://deb.nodesource.com/setup_8.x
view setup_8.x
echo 'deb https://deb.nodesource.com/node_8.x stretch main' > /etc/apt/sources.list.d/nodesource.list
wget -qO - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
apt update
apt install nodejs
npm
is installed as part of that nodejs
package.
Related videos on Youtube
J. Dietz
Updated on September 18, 2022Comments
-
J. Dietz over 1 year
I just tried to install
node
andnpm
on Debian Stretch. I installed node like decribed here.After installing
nodejs-legacy
too I got thenode
command working butnpm
command still won't be found.So, I tried to install it manually via
apt-get install npm
but it just tells me that it can't find the package. Next I tried the "Fancy Install (Unix)" from npm repository which fails withinstall npm@latest fetching: https://registry.npmjs.org/npm/-/npm-5.5.1.tgz module.js:327 throw err; ^ Error: Cannot find module '/tmp/npm.1272/package/bin/read-package-json.js' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Function.Module.runMain (module.js:441:10) at startup (node.js:140:18) at node.js:1043:3 added 1 package and removed 1 package in 0.45s /usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js /usr/bin/npx -> /usr/lib/node_modules/npm/bin/npx-cli.js + [email protected] updated 1 package in 1.21s It worked
Although it creates the link for the
npm
command the links are broken. Does anyone an idea how I can getnpm
running?One more thing: I have the visual studio code repositories in my sources.list which uses node too. Is it possible that that's a reason why it downloads a node package without npm when I do
apt-get install -y nodejs
?Thanks in advance for every answer.
-
jesse_b over 6 yearsYou could try downloading and compiling the source manually: nodejs.org/dist/latest I know that NPM is included in those packages from at least v6 and later. Additionally, I am using NVM on osx to manage versions but it also has install capability...maybe you could try installing via nvm and seeing if that fixes your issue. github.com/creationix/nvm
-
-
J. Dietz almost 6 yearsYes that was a part of my problem, any idea how to circumvent that without nvm (which worked for me)?