[英]Cannot find module 'regenerator-runtime/runtime'
一旦我嘗試使用 Promises,Browserify 就會拋出這個錯誤。
在中找不到模塊“regenerator-runtime/runtime”
我已經嘗試過節點版本 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
};
}
包.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。 我遇到了同樣的錯誤,這為我解決了這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.