简体   繁体   English

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

[英]Can't install node.js on Linux server

I followed some instructions to install node.js on a Linux server and ran in to the following blocks. 我按照一些说明在Linux服务器上安装node.js,然后执行以下块。 I started out by doing sudo apt-get install python-software-properties and that worked fine. 我首先通过sudo apt-get install python-software-properties ,并且效果很好。 Then, I did sudo add-apt-repository ppa:chris-lea/node.js . 然后,我做了sudo add-apt-repository ppa:chris-lea/node.js But, wait - there is no command add-apt-repository . 但是,等等-没有命令add-apt-repository OK, so I looked it up and it told me to do apt-get install software-properties-common and that would have been fine, except it gave me this error: 好的,所以我查了一下,它告诉我要做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

Well, what can I do to get node.js on my server? 好吧,我该怎么办才能在服务器上获取node.js? Obviously, none of this works and it's Debian, in case you were wondering. 显然,如果您想知道的话,这些都不起作用,它是Debian。 I really need help on this. 我真的需要帮助。 Basically, how can I install software-properties-common if it does not exist? 基本上,如果不存在software-properties-common ,如何安装? It just won't show up. 它只是不会显示。

For a Debian install of the latest node.js, you should follow these instructions , not requiring you to add the PPA: 对于最新的node.js的Debian安装,应遵循以下说明 ,而不要求您添加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_*

UPDATE: I wrote this a long time ago. 更新:我很久以前写了这个。 Since then, I find using nvm a much less painful way to get node onto machines. 从那时起,我发现使用nvm可以更轻松地将节点连接到计算机。 As per link, steps are basically reduced to: 按照链接,步骤基本上简化为:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM