无法在Linux服务器上安装node.js.

时间:2013-09-14 04:53:01

标签: linux node.js debian

我按照一些说明在Linux服务器上安装node.js并运行到以下块。我开始做sudo apt-get install python-software-properties并且工作正常。然后,我做了sudo add-apt-repository ppa:chris-lea/node.js。但是,等等 - 没有命令add-apt-repository。好的,所以我查了一下,它告诉我做apt-get install software-properties-common,这本来没问题,除非它给了我这个错误:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package software-properties-common

那么,我该怎么做才能在我的服务器上获取node.js?显然,如果你想知道的话,这一切都不起作用,它是Debian。我真的需要帮助。基本上,如果software-properties-common不存在,我怎么才能安装它?它不会出现。

1 个答案:

答案 0 :(得分:5)

对于最新node.js的Debian安装,您应该关注these instructions,不要求您添加PPA:

sudo apt-get install python g++ make checkinstall
mkdir ~/src && cd $_
wget -N http://nodejs.org/dist/node-latest.tar.gz
tar xzvf node-latest.tar.gz && cd node-v*
./configure
checkinstall #(remove the "v" in front of the version number in the dialog)
sudo dpkg -i node_*

更新:很久以前我写过这篇文章。从那时起,我发现使用nvm将节点放到机器上的方法要少得多。根据链接,步骤基本上简化为:

  • curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
  • nvm install node