Debian-已安装Nodejs,但未安装npm

时间:2018-11-23 14:35:27

标签: node.js npm debian-stretch

我正在遵循https://github.com/nodesource/distributions在Debian上安装Nodejsv11.x。遵循这两个指示后,Nodejs似乎安装正确,并且nodejs -v返回v4.8.2

但是似乎未安装npm。 whereis npm不返回任何内容,我可以肯定地说磁盘上没有安装npm。

我在下面的命令curl -sL https://deb.nodesource.com/setup_11.x | bash -之后粘贴了控制台日志:

+ apt-get update
Hit:1 http://download.virtualbox.org/virtualbox/debian stretch InRelease
Get:2 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu cosmic InRelease [15.4 kB]
Hit:3 http://security.debian.org/debian-security stretch/updates InRelease                                
Ign:2 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu cosmic InRelease           
Hit:4 http://deb.debian.org/debian stretch-backports InRelease                                                                         
Ign:5 http://deb.debian.org/debian stretch InRelease                     
Ign:6 http://ppa.launchpad.net/webupd8team/java/ubuntu disco InRelease   
Hit:7 http://deb.debian.org/debian stretch Release
Ign:9 http://ppa.launchpad.net/webupd8team/java/ubuntu disco Release         
Hit:10 https://download.sublimetext.com apt/stable/ InRelease
Ign:11 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main i386 Packages
Ign:12 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main amd64 Packages
Ign:13 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main all Packages
Ign:14 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main Translation-en_US
Ign:15 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main Translation-en
Ign:16 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main amd64 DEP-11 Metadata
Ign:17 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main all DEP-11 Metadata
Ign:11 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main i386 Packages
Ign:12 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main amd64 Packages
Ign:13 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main all Packages
Ign:14 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main Translation-en_US
Ign:15 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main Translation-en
Ign:16 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main amd64 DEP-11 Metadata
Ign:17 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main all DEP-11 Metadata
Ign:11 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main i386 Packages
Ign:12 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main amd64 Packages
Ign:13 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main all Packages
Ign:14 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main Translation-en_US
Ign:15 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main Translation-en
Ign:16 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main amd64 DEP-11 Metadata
Ign:17 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main all DEP-11 Metadata
Ign:11 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main i386 Packages
Ign:12 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main amd64 Packages
Ign:13 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main all Packages
Ign:14 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main Translation-en_US
Ign:15 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main Translation-en
Ign:16 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main amd64 DEP-11 Metadata
Ign:17 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main all DEP-11 Metadata
Ign:11 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main i386 Packages
Ign:12 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main amd64 Packages
Ign:13 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main all Packages
Ign:14 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main Translation-en_US
Ign:15 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main Translation-en
Ign:16 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main amd64 DEP-11 Metadata
Ign:17 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main all DEP-11 Metadata
Err:11 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main i386 Packages
  404  Not Found
Ign:12 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main amd64 Packages
Ign:13 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main all Packages
Ign:14 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main Translation-en_US
Ign:15 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main Translation-en
Ign:16 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main amd64 DEP-11 Metadata
Ign:17 http://ppa.launchpad.net/webupd8team/java/ubuntu disco/main all DEP-11 Metadata
Fetched 15.4 kB in 16s (929 B/s)
Reading package lists... Done
W: GPG error: http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu cosmic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 005EAE8119BB5BCA
W: The repository 'http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu cosmic InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://ppa.launchpad.net/webupd8team/java/ubuntu disco Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/disco/main/binary-i386/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Error executing command, exiting

我的猜测是,由于apt-get抛出错误,安装程序脚本在过程中停止。但是,即使是那样,我也不知道如何解决这个问题。我不想删除freecad和java的存储库,以使其积极退出。

如果答案与apt-get有关,并且在该论坛上不在主题范围内,也许可以将其迁移到askubuntu?

2 个答案:

答案 0 :(得分:2)

好吧,首先让我们解决关于存储库的错误。

此行告诉您问题所在。

W: GPG error: http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu cosmic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 005EAE8119BB5BCA

您是否遵循了freecad页面上的主要安装说明?参见https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-stable

然后单击“签名”键-这是什么?

关于节点问题,请尝试更新节点: https://www.hostingadvice.com/how-to/update-node-js-latest-version/

另外,尝试sudo apt-get install npm

答案 1 :(得分:1)

尝试修复存​​储库问题会产生奇怪的python错误,这可能与我在系统中同时安装了python 2.7和3有关,但我不确定。

我最终要做的只是暂时从/etc/apt/sources.list.d中删除有问题的存储库,然后再次运行curl脚本。这样可以使脚本运行无任何错误,然后,命令apt install -y nodejs将安装正确的版本以及npm。

问题似乎是debian的默认存储库也有一个nodejs封装,没有npm。并且由于apt-get update错误,安装脚本过早退出。修复该错误即可完成工作。