可以看出,已经有人问了十几次了,但到目前为止,我发现的解决方案都不适用于我.

我已经安装了Node的最新版本.js(12.18.3)安装在我的Windows 10 PC上,我正在try 使用npm安装一个软件包.当我输入npm -v时,它返回的是5.6.0,在我看来这已经过时了——但当我try 安装一个包或更新npm时,每次都会出现以下错误:

npm WARN npm npm does not support Node.js v12.18.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:

我已try 卸载Node.js,删除所有node_模块文件夹,重新安装后重新启动我的电脑,但每次都是一样的.我也try 过使用npm install -g npmnpm install npm@latest -g,但再次出现同样的错误.

有什么解决办法吗?

推荐答案

我找到工作了!

首先你需要打开你的命令行,使用"npm install -g npm@latest"

C:\Users\KimeruLenovo>npm install -g npm@latest
npm WARN npm npm does not support Node.js v14.7.0
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! 
C:\Users\KimeruLenovo\AppData\Roaming\npm-cache\_logs\2020-08 10T09_36_56_388Z-debug.log

转到可以找到调试日志(log)的路径(该文件位于npm缓存文件夹中)

删除NPM和NPM缓存文件夹,但重新安装 node .

这应该可以做到:)

Node.js相关问答推荐

使用ReadableStream.管道时NodeJS Crypto Hash不正确

如何在Reaction应用程序中查看存储的斑点图像?

条件内的表达式

通过 Node js 中的 TBA 执行 netsuite REST upsert 操作出现 401 错误

TS 后端开发:prismagenerate找不到已安装的@tsed/prisma包

如何使用 Node.js 连接到 Cloud SQL?

将 null 推入管道后,node.js 可写完成未发出

每个数组值在 mongodb 中查找一个文档

为什么后端开发需要单独的服务器?

对 google api v3 的 Axios 请求返回加密(?)数据

(Mongoose) 删除 TTL 字段失败

如何在 NestJS 中使用外部生成的 swagger.json?

使用 Node.js 在 MongoDB 中搜索

即使部署成功,也不会触发 Firebase 函数来填充 Firestore 集合.为什么?

类型中缺少属性,该类型是由类实现的接口

在本地运行 Cloud Functions 会出现错误functions.config() 不可用

如何在 NodeJS 中获取操作系统用户名?

向 Stripe 提交付款请求时出现没有此类令牌错误

从 zip 文件在 AWS 中创建 lambda 函数

Express js 阻止 GET /favicon.ico