在 Ubuntu 上安装 Node.js [英] Install Node.js on Ubuntu

查看:36
本文介绍了在 Ubuntu 上安装 Node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Ubuntu 12.10 (Quantal Quetzal),但终端向我显示了关于丢失包裹的错误.我试过这个:

I'm trying install Node.js on Ubuntu 12.10 (Quantal Quetzal), but the terminal shows me an error about lost packages. I tried with this:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm

但是当我来到最后一行时 sudo apt-get install nodejs npm 显示此错误:

But when I came to the last line sudo apt-get install nodejs npm shows this error:

Failed to install some packages. This may mean that
you requested an impossible situation or if you are using the distribution
distribution that some required packages have not yet been created or been
been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nodejs: Conflicts: npm
E: Failed to correct problems, you have held broken packages.

然后我卸载了 ppa:chris-lea/node.js 并尝试了第二个选项:

Then I uninstalled the ppa:chris-lea/node.js and I was trying a second option:

sudo apt-get install node.js
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm

同样的错误,终端说npm is the latest version,但它也显示了我在顶部显示的文本.我认为问题是ppa:chris-lea/node.js,但我不知道如何解决.

The same error, the terminal says npm is the latest version, but it also shows me the text I shown in the top. I think the problem is ppa:chris-lea/node.js, but I don't know how solve it.

推荐答案

只需按照 这里:

示例安装:

sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

它在当前稳定的 Ubuntu 上安装当前稳定的 Node.量子(12.10) 用户可能需要安装software-properties-commonadd-apt-repository 命令的工作包:sudo apt-get install software-properties-common

It installs current stable Node on the current stable Ubuntu. Quantal (12.10) users may need to install the software-properties-common package for the add-apt-repository command to work: sudo apt-get install software-properties-common

从 Node.js v0.10.0 开始,来自 Chris Lea 的 repo 的 nodejs 包包括 npm 和 nodejs-dev.

As of Node.js v0.10.0, the nodejs package from Chris Lea's repo includes both npm and nodejs-dev.

不要给 sudo apt-get install nodejs npm.只需 sudo apt-get install nodejs.

这篇关于在 Ubuntu 上安装 Node.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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