[英]Can't update/install latest npm version
If I use the commands如果我使用命令
apt npm install -g npm
or或者
npm install -g npm@6.14.10
I still get npm@5.6.0 .我仍然得到npm@5.6.0 。 It's really strange.
这真的很奇怪。 I also removed everything and installed it again, but it didn't work.
我还删除了所有内容并重新安装了它,但它没有用。
Following Error comes:出现以下错误:
npm install -g npm
npm WARN npm npm does not support Node.js v14.15.3
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! /home/tom/.npm/_logs/2021-01-03T11_35_05_408Z-debug.log
npm version
npm WARN npm npm does not support Node.js v14.15.3
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
{
npm: '5.6.0',
ares: '1.16.1',
brotli: '1.0.9',
cldr: '37.0',
icu: '67.1',
llhttp: '2.1.3',
modules: '83',
napi: '7',
nghttp2: '1.41.0',
node: '14.15.3',
openssl: '1.1.1g',
tz: '2020a',
unicode: '13.0',
uv: '1.40.0',
v8: '8.4.371.19-node.17',
zlib: '1.2.11'
}
Don't know what I need to change, to solve my problem.不知道我需要改变什么来解决我的问题。 I am very thankfull for every help.
我非常感谢每一个帮助。
Update: (thanks to @Mr.)更新:(感谢@Mr.)
Using command: npm upgrade -g npm --verbose
使用命令:
npm upgrade -g npm --verbose
npm info it worked if it ends with ok
npm WARN npm npm does not support Node.js v14.15.3
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm verb cli [
npm verb cli '/usr/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'upgrade',
npm verb cli '-g',
npm verb cli 'npm',
npm verb cli '--verbose'
npm verb cli ]
npm info using npm@5.6.0
npm info using node@v14.15.3
npm verb npm-session 78951400057ee470
npm verb update computing outdated modules to update
npm verb stack TypeError: cb.apply is not a function
npm verb stack at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
npm verb stack at FSReqCallback.oncomplete (fs.js:184:5)
npm verb cwd /home/tom
npm verb Linux 5.4.0-58-generic
npm verb argv "/usr/bin/node" "/usr/local/bin/npm" "upgrade" "-g" "npm" "--verbose"
npm verb node v14.15.3
npm verb npm v5.6.0
npm ERR! cb.apply is not a function
npm verb exit [ 1, true ]
npm version has a constraint on node version, that is why you get the following error npm 版本对节点版本有限制,这就是你得到以下错误的原因
npm WARN npm npm does not support Node.js v14.15.3
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
to install the latest npm version that coincide with node version, then just upgrade npm as follows安装与node版本一致的最新npm版本,然后升级npm如下
npm upgrade -g npm
otherwise, upgrade your node to latest version before you try to install latest version of npm.否则,请在尝试安装最新版本的 npm 之前将您的节点升级到最新版本。
since you mentioned using sudo
and did not mention whether are you using node version manager, it i hard to debug the issue for you in this manner (there is no way to know how your environment is configured).由于您提到使用
sudo
并且没有提及您是否使用节点版本管理器,因此我很难以这种方式为您调试问题(无法知道您的环境是如何配置的)。
will recommend you to try to run npm in verbose mode建议您尝试在详细模式下运行 npm
npm upgrade -g npm --verbose
to gather more information.收集更多信息。
you need sudo.你需要sudo。
sudo npm install -g npm@6.14.10
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.