本文介绍了Babel-错误:找不到模块"babel-runtime/helpers/typeof"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过服务器的gulp-babel进行编译,通过客户端的babelify通过browserify进行编译-在我的代码中使用async和await.这些功能似乎可以很好地转换,但是...Error: Cannot find module 'babel-runtime/helpers/typeof'

Transpiling via gulp-babel for the server and browserify with babelify for the client - using async and await in my code. These features seem to transform just fine, but...Error: Cannot find module 'babel-runtime/helpers/typeof'

.babelrc

{
  "presets": ["react", "es2015"],
  "plugins": [
    "transform-class-properties",
    "transform-async-to-generator",
    "transform-runtime"
  ]
}

package.json

"babel-core": "6.3.13",
"babel-eslint": "4.1.6",
"babel-plugin-transform-async-to-generator": "6.3.13",
"babel-plugin-transform-class-properties": "6.3.13",
"babel-plugin-transform-runtime": "6.3.13",
"babel-preset-es2015": "6.3.13",
"babel-preset-react": "6.3.13",
"babelify": "7.2.0",
"browserify": "12.0.1",
"gulp-babel": "6.1.0",

我还发现了其他一些提及,其中许多提及似乎都在这里- https://github.com/babel/babel/issues/2954

I have found a few other mentions of this, many of which seem to lead here - https://github.com/babel/babel/issues/2954

但是我在上面的链接中收到404,并且确实看不到与babel相关的任何问题- https://github.com/babel/babel/issues 重定向到 https://github. com/babel/babel/pulls

But I am getting a 404 at the link above and indeed cannot see any issues related to babel - https://github.com/babel/babel/issues redirects to https://github.com/babel/babel/pulls

有什么想法吗?

推荐答案

原来,我需要安装babel-runtime,我认为该版本已随Babel v6的发行版弃用.

Turns out I needed to take the install of babel-runtime, which I thought had been deprecated with the release of Babel v6.

这篇关于Babel-错误:找不到模块"babel-runtime/helpers/typeof"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 04:54