【问题记录】next项目打包构建报错(npm WARN deprecated @babel/polyfill@7.12.1)

15 篇文章 0 订阅
2 篇文章 0 订阅

next项目打包构建报错
报错如下:

npm WARN deprecated @babel/polyfill@7.12.1: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN notsup Unsupported engine for next@12.3.1: wanted: {"node":">=12.22.0"} (current: {"node":"12.18.3","npm":"6.14.7"})
npm WARN notsup Not compatible with your version of node/npm: next@12.3.1

翻译后:

@babel/polyfill@7.12.1:🚨该包已弃用,支持单独包含一个多边形和再生器运行时(当需要时)。更多信息请参见@babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill)。

npm WARN已弃用core-js@2.6.12: core-js@❤️.3不再维护,由于存在大量问题,不建议使用。由于V8引擎的奇思怪想,旧的core-js版本的特性检测可能会导致减速高达100倍,即使没有任何polyfilled。请将您的依赖项升级到core-js的实际版本。

npm WARN notsup不支持引擎next@12.3.1: wanted: {“node”:“>=12.22.0”}(当前:{“node”:“12.18.3”,“npm”:“6.14.7”})

与你的node/npm版本不兼容:next@12.3.1

解决:
尝试1:升级core-js

npm i core-js@latest

发现没有什么用

尝试2:
搜索发现@babel/polyfill已经弃用,执行 npm uninstall @babel/polyfill
提交最新的package.json
发现构建还是失败……
但是报错变成了其他:

npm WARN notsup Unsupported engine for next@12.3.1: wanted: {"node":">=12.22.0"} (current: {"node":"12.18.3","npm":"6.14.7"})
npm WARN notsup Not compatible with your version of node/npm: next@12.3.1

npm ERR! Unexpected end of JSON input while parsing near '...9e1TEhiY7BZKUWCe5VVR/'

尝试3:
报错变了,怀疑是包之间的依赖版本有问题,决定重新装下依赖
删掉node_modules
npm i rimraf -g 安装rimraf
打开node_modelus文件所在位置的cmd,输入 rimraf node_modules,快速删除node_modules
再删除package-lock.json, yarn-lock.json
执行 npm i, 重新装一遍依赖,把新生成的package-lock.json文件重新提交代码

打包构建,成功了!问题解决

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值