gpt4 book ai didi

node.js - 在 Ubuntu 14.04 上安装 Node 5.x 和最新或正在运行的 npm

转载 作者:搜寻专家 更新时间:2023-11-01 00:23:14 26 4
gpt4 key购买 nike

我在 Azure 上有一个 Ubuntu 14.04 虚拟机。我只是尝试升级 Node 和 npm,但似乎已经损坏了它。我已经多次删除和清除并清除缓存。 Nodejs 将安装,但 npm 不会安装。

> node -v
v5.1.1

我得到了 npm 的以下信息:

> sudo apt-get install npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
npm : Depends: nodejs but it is not going to be installed
Depends: node-abbrev (>= 1.0.4) but it is not going to be installed
Depends: node-ansi but it is not going to be installed
Depends: node-archy but it is not going to be installed
Depends: node-block-stream but it is not going to be installed
Depends: node-fstream (>= 0.1.22) but it is not going to be installed
Depends: node-fstream-ignore but it is not going to be installed
Depends: node-github-url-from-git but it is not going to be installed
Depends: node-glob (>= 3.1.21) but it is not going to be installed
Depends: node-graceful-fs (>= 2.0.0) but it is not going to be installed
Depends: node-inherits but it is not going to be installed
Depends: node-ini (>= 1.1.0) but it is not going to be installed
Depends: node-lockfile but it is not going to be installed
Depends: node-lru-cache (>= 2.3.0) but it is not going to be installed
Depends: node-minimatch (>= 0.2.11) but it is not going to be installed
Depends: node-mkdirp (>= 0.3.3) but it is not going to be installed
Depends: node-gyp (>= 0.10.9) but it is not going to be installed
Depends: node-nopt (>= 2.1.1) but it is not going to be installed
Depends: node-npmlog but it is not going to be installed
Depends: node-once but it is not going to be installed
Depends: node-osenv but it is not going to be installed
Depends: node-read but it is not going to be installed
Depends: node-read-package-json (>= 1.1.0) but it is not going to be installed
Depends: node-request (>= 2.25.0) but it is not going to be installed
Depends: node-retry but it is not going to be installed
Depends: node-rimraf (>= 2.2.2) but it is not going to be installed
Depends: node-semver (>= 2.1.0) but it is not going to be installed
Depends: node-sha but it is not going to be installed
Depends: node-slide but it is not going to be installed
Depends: node-tar (>= 0.1.18) but it is not going to be installed
Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我的 apt-get 更新如下所示:

> sudo apt-get update
Ign http://debian.neo4j.org stable/ InRelease
Ign http://azure.archive.ubuntu.com trusty InRelease
Ign http://repo.mongodb.org trusty/mongodb-org/3.0 InRelease
Hit http://security.ubuntu.com trusty-security InRelease
Get:1 http://debian.neo4j.org stable/ Release.gpg [819 B]
Hit http://azure.archive.ubuntu.com trusty-updates InRelease
Hit http://azure.archive.ubuntu.com trusty Release.gpg
Hit http://repo.mongodb.org trusty/mongodb-org/3.0 Release.gpg
Hit http://debian.neo4j.org stable/ Release
Hit http://repo.mongodb.org trusty/mongodb-org/3.0 Release
Hit http://azure.archive.ubuntu.com trusty Release
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://azure.archive.ubuntu.com trusty-updates/main Sources
Hit http://repo.mongodb.org trusty/mongodb-org/3.0/multiverse amd64 Packages
Hit http://debian.neo4j.org stable/ Packages
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://azure.archive.ubuntu.com trusty-updates/universe Sources
Hit http://azure.archive.ubuntu.com trusty-updates/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://azure.archive.ubuntu.com trusty-updates/universe amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://azure.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://azure.archive.ubuntu.com trusty-updates/universe Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://azure.archive.ubuntu.com trusty/main Sources
Hit http://azure.archive.ubuntu.com trusty/universe Sources
Hit http://azure.archive.ubuntu.com trusty/main amd64 Packages
Hit http://azure.archive.ubuntu.com trusty/universe amd64 Packages
Ign http://debian.neo4j.org stable/ Translation-en_US
Ign http://debian.neo4j.org stable/ Translation-en
Hit http://azure.archive.ubuntu.com trusty/main Translation-en
Hit http://azure.archive.ubuntu.com trusty/universe Translation-en
Ign http://azure.archive.ubuntu.com trusty/main Translation-en_US
Ign http://repo.mongodb.org trusty/mongodb-org/3.0/multiverse Translation-en_US
Ign http://azure.archive.ubuntu.com trusty/universe Translation-en_US
Ign http://repo.mongodb.org trusty/mongodb-org/3.0/multiverse Translation-en
Hit https://deb.nodesource.com trusty InRelease
Hit https://deb.nodesource.com trusty/main Sources
Hit https://deb.nodesource.com trusty/main amd64 Packages
Get:2 https://deb.nodesource.com trusty/main Translation-en_US
Ign https://deb.nodesource.com trusty/main Translation-en_US
Ign https://deb.nodesource.com trusty/main Translation-en
Fetched 819 B in 6s (131 B/s)
Reading package lists... Done

最佳答案

你可以试试这个

sudo apt-get purge node
sudo apt-get purge npm
sudo apt-get autoremove node
sudo apt-get autoremove npm
curl https://raw.githubusercontent.com/creationix/nvm/v0.11.1/install.sh | bash

=> 关闭并重新打开终端以开始使用 NVM

source ~/.profile
nvm ls-remote

如果您看到任何错误,请安装 git(sudo apt-get install git)

nvm install 5.0 //or any of the version you want to use
nvm use 5.0 ///use the version which ever you want and need not install npm as it will installed with it

希望这对你有帮助:)

关于node.js - 在 Ubuntu 14.04 上安装 Node 5.x 和最新或正在运行的 npm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34115114/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com