npm 不支持 Node.js [英] npm does not support Node.js

查看:88
本文介绍了npm 不支持 Node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

npm 不支持 Node.js v15.5.0 和 v14.15.3

npm 版本:5.6.0

npm Version: 5.6.0

我通过以下命令升级它:npm i -g npm-upgrade但是我没有得到第 6 版,我总是得到 5.6.0 版

I upgraded it trough the command: npm i -g npm-upgrade But I don't get version 6, I always get version 5.6.0

我还根据 426750.

我尝试了以下 Node.js 版本:v15、v14、v12、v9.不管我安装哪个 Node.js 版本,我总是遇到同样的错误.

I tried following Node.js versions: v15, v14, v12, v9. It doesn't matter which Node.js version I install, i always get the samme error.

我还删除了 Node.js 并按照 4722623863196042.

I also removed Node.js and updated it as recommended in 47226238, 63196042.

我不知道如何解决这个问题.你有什么建议吗?

I have no Idea how I can fix this problem. Do you have any suggestion?

推荐答案

更新 npm 的正确命令是 npm install -g npm.在撰写本文时,将安装 npm@6.14.10.(如果没有,请尝试 npm install -g npm@6.)

The correct command to update npm is npm install -g npm. At the time of this writing, that will install npm@6.14.10. (If it doesn't, try npm install -g npm@6.)

安装 npm-upgrade 将安装 一个更新包的 CLI.项目中的 json .它不会更新 npm 本身.

Installing npm-upgrade instead will install a CLI that updates package.json in projects. It will not update npm itself.

版本兼容性内容只是一个警告.根据下面的评论,ERR!cb.apply 不是函数 东西才是真正的问题.您可能在不同的路径中安装了多个版本的 npmnode,并且您的 PATH 或别名配置导致不兼容的版本彼此运行.

The version compatibility stuff is just a warning. Based on the comment below, the ERR! cb.apply is not a function stuff is the real problem. You may have multiple versions of npm or node installed in different paths and your PATH or alias configuration is causing incompatible versions to run with each other.

编辑(续):如果您使用 nvm 作为版本管理器,您可以降级到以前的版本,删除/重新安装当前版本的 Node.js,您将拥有一个兼容的npm 的版本.如果您没有使用 nvm,请安装a>(假设您在开发机器上并且在生产中没有遇到这些问题)并且使用它提供的 nodenpm 也应该可以解决问题.

EDIT (continued): If you are using nvm as a version manager, you can downgrade to a previous version, remove/reinstall the current version of Node.js, and you will have a compatible version of npm. If you are not using nvm, installing it (assuming you are on a development machine and not experiencing these issues in production) and using node and npm provided by it should also solve the issue.

编辑第 3 部分:我刚刚注意到您正在运行 Node.js 15.5.0.随 npm@7 一起提供,npm install -g npm@7 也是如此.如果这不起作用,请找到 nodenpm 的可执行路径.(在类 UNIX 操作系统上:command -v nodecommand -v npm.)如果它们不在同一目录中,这听起来像是一个问题,您应该调查.使用与 node 位于同一目录中的 npm 可能是最简单/最好的.您可以使用完整路径进行尝试.如果可行,请找出您的 PATH 或您使用不同 npm 的别名有什么问题并修复它.

EDIT PART 3: I just noticed you are running Node.js 15.5.0. That ships with npm@7 so do npm install -g npm@7. If that doesn't work, find your executable paths for node and npm. (On UNIX-like operating systems: command -v node and command -v npm.) If they are not in the same directories, that sounds like a problem and you should investigate. It will probably be easiest/best to use the npm that is in the same directory as node. You can try that out by using the full path. If that works, figure out what's wrong with your PATH or your aliases that you're using a different npm and fix that.

这篇关于npm 不支持 Node.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆