![在 Debian Jessie 上设置节点](https://linux22.com/image/100897/%E5%9C%A8%20Debian%20Jessie%20%E4%B8%8A%E8%AE%BE%E7%BD%AE%E8%8A%82%E7%82%B9.png)
我想得到NodeJS安装在我的服务器上。
说明建议执行以下操作:
sudo apt-get update
sudo apt-get install nodejs
我得到:
root@steampunklinode:~# sudo apt-get update
Hit http://nginx.org jessie InRelease
Hit http://nginx.org jessie/nginx Sources
Hit http://nginx.org jessie/nginx amd64 Packages
Ign http://nginx.org jessie/nginx Translation-en_US
Ign http://nginx.org jessie/nginx Translation-en
Reading package lists... Done
root@steampunklinode:~# sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package nodejs
我找到了这个帖子:
如何在 Debian Jessie 上安装最新的 NodeJS?
我尝试了那里的建议,但出现错误:
root@steampunklinode:~# curl -sL https://deb.nodesource.com/setup | bash -
================================================================================
================================================================================
SCRIPT DEPRECATION WARNING
This script, located at https://deb.nodesource.com/setup, used to
install Node.js v0.10, is being deprecated and will eventually be made
inactive.
You should use the script that corresponds to the version of Node.js you
wish to install. e.g.
* https://deb.nodesource.com/setup_4.x â Node.js v4 LTS "Argon" (recommended)
* https://deb.nodesource.com/setup_6.x â Node.js v6 Current
Please see https://github.com/nodejs/LTS/ for details about which version
may be appropriate for you.
The NodeSource Node.js Linux distributions GitHub repository contains
information about which versions of Node.js and which Linux distributions
are supported and how to use the install scripts.
https://github.com/nodesource/distributions
================================================================================
================================================================================
Continuing in 10 seconds (press Ctrl-C to abort) ...
## Installing the NodeSource Node.js v0.10 repo...
## Populating apt-get cache...
+ apt-get update
Hit http://nginx.org jessie InRelease
Hit http://nginx.org jessie/nginx Sources
Hit http://nginx.org jessie/nginx amd64 Packages
Ign http://nginx.org jessie/nginx Translation-en_US
Ign http://nginx.org jessie/nginx Translation-en
Reading package lists... Done
## Installing packages required for setup: apt-transport-https...
+ apt-get install -y apt-transport-https > /dev/null 2>&1
Error executing command, exiting
有人可以指出我正确的方向吗?我一定是错过了一些愚蠢的东西!谢谢
答案1
您的存储库配置错误。由于您正在运行 Jessie,因此您/etc/apt/sources.list
需要
deb http://httpredir.debian.org/debian jessie main
deb-src http://httpredir.debian.org/debian jessie main
deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main
根据你的apt-get update
输出,看起来你只有 Nginx 存储库。如果添加上述行,您将能够nodejs
按照您链接到的说明再次更新并使用 Debian 软件包 (0.10) 或更新版本安装 Node。