我对 jessie 和 npm 有问题。
我已经用 sudo apt-get install nodejs
安装了包 nodejs ,所以它自动安装了 npm。
然后我想使用 npm i -g npm@latest
安装最新的 npm ,除了 apt npm 版本冲突外,它工作正常。
如果从 apt 安装,我想删除冲突的 apt 安装版本,或者知道更新 npm 的官方方法。
我只能使用 npm i -g n
更新 Node 然后 n stable
但是我不可能升级 npm
最佳答案
npm 是随 Node.js 一起发布的——这意味着当你下载 时Node.js,你会自动在你的电脑上安装 npm .
引自 The npm Blog
The best way to install npm is to install node using the node.js installer.
npm
is installed as part of node.
结束于 nodejs.org .它将为您提供最新的 npm 工作版本,其中包含预期位置中的所有路径。这是 npm Inc 和 Node.js 项目都支持的版本。
一旦你安装了 Node.js,你就可以确保你拥有最新版本的
npm
使用 npm
自己通过运行这个:npm install npm -g
如果您有问题,请不要使用
sudo
, 阅读文档 fixing npm permissions仔细配置npm
适本地。
关于node.js - 安装 apt 后如何在 debian 上正确升级 npm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49996532/