E: 无法定位包 npm [英] E: Unable to locate package npm
问题描述
当我尝试使用 sudo apt-get install npm
安装 npm 时,出现以下错误:
E: 无法定位包 npm
为什么apt找不到npm?我正在使用 Debian 9 并且已经运行
sudo apt-get install nodejs
来自 Node.js 官方文档:
<块引用>Debian Sid(不稳定)、Jessie(测试)和 Wheezy(wheezy-backports)的官方存储库中也提供了一个 Node.js 包作为nodejs".它只安装一个 nodejs 二进制文件.
因此,如果您只输入 sudo apt-get install nodejs
,它不会安装其他好东西,例如 npm.
您需要输入:
curl -sL https://deb.nodesource.com/setup_14.x |须藤 -E bash -sudo apt-get install -y nodejs
<块引用>
可选:安装构建工具
<块引用>
要从 npm 编译和安装本机附加组件,您可能还需要安装构建工具:
sudo apt-get install -y build-essential
更多信息:文档 NodeJs
When I try to install npm with sudo apt-get install npm
, I got following error:
E: Unable to locate package npm
Why can't apt find npm? I'm using Debian 9 and already did run
sudo apt-get install nodejs
From the official Node.js documentation:
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.
So, if you only type sudo apt-get install nodejs
, it does not install other goodies such as npm.
You need to type:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Optional: install build tools
To compile and install native add-ons from npm you may also need to install build tools:
sudo apt-get install -y build-essential
More info: Docs NodeJs
这篇关于E: 无法定位包 npm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!