Module not found: Can't resolve '@babel/runtime/helpers/esm/assertThisInitialized'

本文解决了一个常见的Babel错误:无法解析 '@babel/runtime/helpers/esm/assertThisInitialized'。通过删除node_modules文件夹并重新运行npm install,或者更新@babel/runtime版本到7.0.0-beta.55,以及修改package.json中roadhog的版本到2.5.0-beta.4,最终解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Module not found: Can't resolve '@babel/runtime/helpers/esm/assertThisInitialized'

解决问题:不知道是哪一种解决的,是采用了两种办法,重要的是删除的node_modules然后再npm i然后就可以了。
具体不知道是哪种解决的问题
1.安装:

	
npm i @babel/runtime@7.0.0-beta.55 --save

2.修改packages.js中的roadhog为一下代码

"roadhog": "^2.5.0-beta.4"

删除安装包,重新npm install,然后就解决问题了

ERROR in ./node_modules/axios/lib/utils.js 3:0-146 Module not found: Error: Can't resolve 'D:/dp-project/callisto-h5/node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray' in 'D:\dp-project\callisto-h5\node_modules\axios\lib' Did you mean 'slicedToArray.js'? BREAKING CHANGE: The request 'D:/dp-project/callisto-h5/node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray' failed to resolve only because it was resolved as fully specified (probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request. @ ./node_modules/axios/lib/axios.js 3:0-31 32:2-14 36:2-14 74:24-40 @ ./node_modules/axios/index.js 1:0-35 5:12-23 6:17-33 7:20-39 8:15-29 9:18-35 10:14-27 11:10-19 12:13-25 13:19-37 14:13-25 15:17-33 16:19-37 17:21-41 18:17-33 19:17-33 20:18-35 21:0-208 @ ./src/utils/request.ts 2:0-26 111:9-14 @ ./src/utils/index.ts @ ./src/layouts/index.tsx @ ./src/.umi-production/core/routes.ts @ ./src/.umi-production/umi.ts 9:0-42 25:33-42 webpack compiled with 31 errors null build failed Error: build failed at D:\dp-project\callisto-h5\node_modules\@umijs\bundler-webpack\lib\index.js:172:29 at D:\dp-project\callisto-h5\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:114591:14 at processQueueWorker (D:\dp-project\callisto-h5\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:114529:6) at processTicksAndRejections (node:internal/process/task_queues:78:11) error Command failed with exit code 1.
最新发布
03-19
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值