我正在尝试在Ubuntu 12.10上安装Node.js,但是终端向我显示有关丢失软件包的错误。我尝试了这个:
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
显示此错误:
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
,并尝试了第二种选择:
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
但我不知道如何解决。
Install Node.js on Ubuntu
12.10
or14.04 LTS
or16.04.1 LTS
Please avoid to install
Node.js
withapt-get
onUbuntu
. If you already installed Node.js with the built in package manager, please remove that. (sudo apt-get purge nodejs && sudo apt-get autoremove && sudo apt-get autoclean
)The installation process on Linux is the same as on
OSX
. With the provided script:One more thing! Don’t forget to run the following command, which increases the amount of inotify watches.
Hope this help you!