gpt4 book ai didi

javascript - 找不到模块 'regenerator-runtime/runtime'

转载 作者:太空宇宙 更新时间:2023-11-03 23:58:37 29 4
gpt4 key购买 nike

一旦我尝试使用 Promises,Browserify 就会抛出此错误。

中找不到模块“regenerator-runtime/runtime”

我尝试过 Node 版本 10.15.3 和 12.0.0。

为什么它在源文件夹中查找它而不是node_modules?

这是我的 babel.config.js

module.exports = function (api) {
api.cache(true);

const presets = [
["@babel/preset-env", {
"useBuiltIns": "usage",
"corejs": "2.6.5"
}

]];
const plugins = [];

return {
presets,
plugins
};
}

package.json

{
"name": "ehrsWAR",
"version": "1.10.15",
"private": true,
"scripts": {},
"browserslist": [
"> 5%",
"last 2 versions",
"Firefox > 20",
"ie >= 9"
],
"devDependencies": {
"@babel/cli": "^7.4.3",
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@babel/register": "^7.4.0",
"babelify": "^10.0.0",
"browserify": "^16.2.3",
"gulp": "^4.0.0",
"gulp-rename": "^1.4.0",
"gulp-streamify": "^1.0.2",
"gulp-uglify": "^3.0.2",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0",
"watchify": "^3.11.1"
},
"browserify": {
"transform": [
"babelify"
]
},
"dependencies": {
"core-js": "^2.6.5"
}
}

最佳答案

尝试在 babel 配置下的插件中包含“@babel/transform-runtime”。并在 package.json 中包含 @babel/plugin-transform-runtime。我遇到了同样的错误,这解决了我的问题。

关于javascript - 找不到模块 'regenerator-runtime/runtime',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55857804/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com