前端报错npm ERR cb() never called问题

环境使用node版本v14.21.3,npm版本6.14.18

1.问题描述

1.1使用npm install后报错

复制代码
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! ? ? <https://npm.community>

npm ERR! A complete log of this run can be found in:

2.解决问题过程

2.1看网上大部分的解决方式是:

删除_node_modules_目录,删除_package-lock.json_文件,清除缓存,再重新npm install,不过一般出现这个问题并不会生成_package-lock.json_文件

2.2网上还有部分的解决方式是:

使用npm uninstall -g npm更新npm版本来解决这个问题,不过我们一般会安装node和npm的匹配版本。

如果node和npm版本不匹配就会报这个问题

复制代码
ERROR: npm v10.5.0 is known not to run on Node.js v14.21.3. ?This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at https://nodejs.org/.

ERROR:
D:Program Files
odejs
ode_cache
ode_modules
pm
ode_modules@npmcliagentlibagents.js:105
? ? options.lookup ??= this.#options.lookup
? ? ? ? ? ? ? ? ? ?^^^

SyntaxError: Unexpected token '??='
? ? at wrapSafe (internal/modules/cjs/loader.js:1029:16)
? ? at Module._compile (internal/modules/cjs/loader.js:1078:27)
? ? at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
? ? at Module.load (internal/modules/cjs/loader.js:979:32)
? ? at Function.Module._load (internal/modules/cjs/loader.js:819:12)
? ? at Module.require (internal/modules/cjs/loader.js:1003:19)
? ? at require (internal/modules/cjs/helpers.js:107:18)
? ? at Object.<anonymous> (D:Program Files
odejs
ode_cache
ode_modules
pm
ode_modules@npmcliagentlibindex.js:7:15)
? ? at Module._compile (internal/modules/cjs/loader.js:1114:14)
? ? at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
2.2.1如果你不幸的按照网上使用npm uninstall -g npm升级了版本

那么可以去删除nodejs ode_cache ode_modules pm的文件,原来的npm文件会在nodejs ode_modules目录下。不需要重装node和npm来解决

3.解决步骤

好了,现在回到我们一开始需要解决的这个问题上。

导致这个问题是文件夹的权限没放开导致的,知道的就可以不往下面看了。

不知道调整文件夹权限的按照下方的图片步骤解决即可。调整的是代码所在文件夹

弄完之后去之前报错的前端项目下使用npm install命令即可

相关推荐
S***H28322 分钟前
前端动画实现经验,性能优化与兼容性
前端
xw543 分钟前
前端跨标签页通信方案(下)
前端·javascript
zzlyx991 小时前
IoTSharp前端VUE采用npm run build编译提示require() of ES Module 出错
前端·vue.js·npm
全栈技术负责人1 小时前
拒绝“无法复现”:前端全链路日志排查实战手册
前端·全链路·问题排查思路
加洛斯1 小时前
前端小知识003:JS中 == 与 === 的区别
开发语言·前端·javascript
b***9102 小时前
【SpringBoot3】Spring Boot 3.0 集成 Mybatis Plus
android·前端·后端·mybatis
G***E3162 小时前
前端路由懒加载实现,Vue Router与React Router
前端·vue.js·react.js
Jonathan Star2 小时前
前端需要做单元测试吗?哪些适合做?
前端·单元测试·状态模式
eason_fan2 小时前
解决 Monorepo 项目中 node-sass 安装失败的 Python 版本兼容性问题
前端·debug
q***73552 小时前
删除文件夹,被提示“需要来自 TrustedInstaller 的权限。。。”的解决方案
android·前端·后端