2015-11-05 294 views
0

我有问题安装npmapt-get。请参阅下面的日志:Ubuntu无法安装npm

[email protected]:~$ sudo apt-get install npm 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
The following packages were automatically installed and are no longer required: 
    libaudclient2 libid3tag0 libimlib2 libxmmsclient6 linux-headers-3.16.0-39 linux-headers-3.16.0-39-generic linux-headers-generic 
    linux-image-3.16.0-39-generic linux-image-extra-3.16.0-39-generic linux-image-generic rlwrap thermald 
Use 'apt-get autoremove' to remove them. 
The following extra packages will be installed: 
    gyp javascript-common libc-ares-dev libjs-node-uuid libjs-underscore libssl-dev libssl-doc libv8-3.14-dev node-abbrev node-ansi node-ansi-color-table 
    node-archy node-async node-block-stream node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fstream 
    node-fstream-ignore node-github-url-from-git node-glob node-graceful-fs node-gyp node-inherits node-ini node-json-stringify-safe node-lockfile 
    node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog node-once node-osenv 
    node-qs node-read node-read-package-json node-request node-retry node-rimraf node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent 
    node-underscore node-which nodejs-dev 
Suggested packages: 
    node-hawk node-aws-sign node-oauth-sign node-http-signature 
The following NEW packages will be installed: 
    gyp javascript-common libc-ares-dev libjs-node-uuid libjs-underscore libssl-dev libssl-doc libv8-3.14-dev node-abbrev node-ansi node-ansi-color-table 
    node-archy node-async node-block-stream node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fstream 
    node-fstream-ignore node-github-url-from-git node-glob node-graceful-fs node-gyp node-inherits node-ini node-json-stringify-safe node-lockfile 
    node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog node-once node-osenv 
    node-qs node-read node-read-package-json node-request node-retry node-rimraf node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent 
    node-underscore node-which nodejs-dev npm 
0 upgraded, 56 newly installed, 0 to remove and 2 not upgraded. 
1 not fully installed or removed. 
Need to get 2054 kB/3345 kB of archives. 
After this operation, 15,2 MB of additional disk space will be used. 
Do you want to continue? [Y/n] y 
WARNING: The following packages cannot be authenticated! 
    gyp javascript-common libjs-node-uuid libjs-underscore libssl-dev libssl-doc libv8-3.14-dev node-async node-node-uuid node-underscore libc-ares-dev 
    node-abbrev node-ansi node-ansi-color-table node-archy node-inherits node-block-stream node-delayed-stream node-combined-stream node-cookie-jar 
    node-forever-agent node-mime node-form-data node-rimraf node-mkdirp node-graceful-fs node-fstream node-lru-cache node-sigmund node-minimatch 
    node-fstream-ignore node-github-url-from-git node-once node-glob nodejs-dev node-nopt node-npmlog node-osenv node-tunnel-agent node-json-stringify-safe 
    node-qs node-request node-semver node-tar node-which node-gyp node-ini node-lockfile node-mute-stream node-normalize-package-data node-read 
    node-read-package-json node-retry node-sha node-slide npm 
Install these packages without verification? [y/N] y 
Err http://si.archive.ubuntu.com/ubuntu/ utopic-updates/main libssl-dev amd64 1.0.1f-1ubuntu9.8 
    404 Not Found [IP: 193.2.1.88 80] 
Err http://security.ubuntu.com/ubuntu/ utopic-security/main libssl-dev amd64 1.0.1f-1ubuntu9.8 
    404 Not Found [IP: 91.189.88.149 80] 
Err http://security.ubuntu.com/ubuntu/ utopic-security/main libssl-doc all 1.0.1f-1ubuntu9.8 
    404 Not Found [IP: 91.189.88.149 80] 
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.0.1f-1ubuntu9.8_amd64.deb 404 Not Found [IP: 91.189.88.149 80] 

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-doc_1.0.1f-1ubuntu9.8_all.deb 404 Not Found [IP: 91.189.88.149 80] 

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? 
+2

此问题属于http://askubuntu.com/ –

回答

0

NodeJS软件包包含npm。

如何通过包管理器安装:

$ curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - 
    $ sudo apt-get install -y nodejs 
    $ sudo ln -s "$(which nodejs)" /usr/bin/node 

可选:安装编译工具

编译并安装NPM本地插件,你可能还需要安装编译工具:

$ sudo apt-get install -y build-essential 

来源:https://nodejs.org/en/download/package-manager/

我希望帮助d你