“Users \\ PhpstormProjects \\ easy-essay \\。babelrc”中指定的未知插件“transform-runtime”

时间:2017-05-10 14:10:41

标签: javascript angularjs node.js gulp babeljs

我已经下载了一个github存储库。

在名为.babelrc.json的文件中,我有这个:

{
  "presets": [
    "es2015",
    "stage-0"
  ],
  "plugins": [
    "transform-runtime",
    "add-module-exports",
    "transform-decorators-legacy"
  ]
}

当我运行gulp dev时,我收到以下错误:

  

ReferenceError:未知插件“transform-runtime”   “C:\ Users \ Tolotra Samuel \ PhpstormProjects \ easy-essay \ .babelrc”at at   0,尝试解析相对于“C:\ Users \ \ Tolotra   塞缪尔\ PhpstormProjects \轻松小品”       在C:\ Users \ Tolotra Samuel \ PhpstormProjects \ easy-essay \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:180:17       在Array.map(本机)       在Function.normalisePlugins(C:\ Users \ Tolotra Samuel \ PhpstormProjects \ easy-essay \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:158:20)       在OptionManager.mergeOptions(C:\ Users \ Tolotra Samuel \ PhpstormProjects \ easy-essay \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:234:36)       在OptionManager.init(C:\ Users \ Tolotra Samuel \ PhpstormProjects \ easy-essay \ node_modules \ babel-core \ lib \ transformation \ file \ options \ option-manager.js:368:12)       在编译时(C:\ Users \ Tolotra Samuel \ PhpstormProjects \ easy-essay \ node_modules \ babel-register \ lib \ node.js:103:45)       在loader(C:\ Users \ Tolotra Samuel \ PhpstormProjects \ easy-essay \ node_modules \ babel-register \ lib \ node.js:144:14)       at Object.require.extensions。(匿名函数)[as .js](C:\ Users \ Tolotra   塞缪尔\ PhpstormProjects \易于文章\ node_modules \巴贝尔寄存器\ lib中\的node.js:154:7)       在Module.load(module.js:488:32)       在tryModuleLoad(module.js:447:12)

正如自述文件中所提到的,我已经运行了npm installbower install。 我错过了什么?

1 个答案:

答案 0 :(得分:4)

yarn add babel-plugin-transform-runtime

为我解决了,为你做什么?

或npm或凉亭。 但是别忘了参考上面提到的babel-plugin。来自巴贝尔的lib。 看起来它是一个bug,提到全球安装babel =)

在您尝试了这个>

之后,您有错误参考es2015
yarn add babel-plugin-transform-runtime babel-preset-es2015 babel-preset-stage-2 --dev