如果我使用这些命令
apt npm install -g npm或
npm install -g npm@6.14.10我仍然得到npm@5.6.0。真的很奇怪。我也删除了所有的东西,并重新安装,但它没有工作。
出现以下错误:
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.lognpm 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'
}不知道我需要改变什么来解决我的问题。我非常感谢所有的帮助。
更新:(感谢@Mr..)
使用命令: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 ]发布于 2021-01-03 12:45:43
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版本,只需按以下方式升级npm
npm upgrade -g npm否则,在尝试安装npm的最新版本之前,请将节点升级到最新版本。
由于您提到使用sudo,而没有提到是否使用节点版本管理器,所以我很难以这种方式为您调试这个问题(无法知道您的环境是如何配置的)。
将建议您尝试运行冗长式npm。
npm upgrade -g npm --verbose收集更多的信息。
https://stackoverflow.com/questions/65549404
复制相似问题