E:无法找到软件包npm [英] E: Unable to locate package npm

查看:276
本文介绍了E:无法找到软件包npm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用sudo apt-get install npm安装npm时,出现以下错误:

When I try to install npm with sudo apt-get install npm, I got following error:

E:无法找到软件包npm

E: Unable to locate package npm

为什么找不到npm?我正在使用Debian 9,并且已经运行

Why can't apt find npm? I'm using Debian 9 and already did run

sudo apt-get install nodejs

推荐答案

来自Node.js官方文档:

From the official Node.js documentation:

Node.js软件包在Debian Sid(不稳定),Jessie(测试)和Wheezy(wheezy-backports)的官方仓库中也以"nodejs"的形式提供. 它仅安装nodejs二进制文件.

因此,如果仅键入sudo apt-get install nodejs,则它不会安装其他商品,例如 npm .

So, if you only type sudo apt-get install nodejs , it does not install other goodies such as npm.

您需要输入:

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

可选:安装构建工具

Optional: install build tools

要从npm编译并安装本机加载项,您可能还需要安装构建工具:

To compile and install native add-ons from npm you may also need to install build tools:

sudo apt-get install -y build-essential

更多信息:文档

这篇关于E:无法找到软件包npm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆