E: 无法定位包 npm [英] E: Unable to locate package npm

查看:61
本文介绍了E: 无法定位包 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屋!

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