react-native init 给出错误:找不到预设“es2015”

2024-02-18

当我尝试从头开始一个新的反应本机项目时,我收到了这条消息。

/Users/jorgevenegas/Dev/Projects/testreact/List/node_modules/react-native/node_modules/babel-core/lib/transformation/file/options/option-manager.js:327
          throw new Error("Couldn't find preset " + JSON.stringify(val) + " relative to directory " + JSON.stringify(dirname));
          ^

Error: Couldn't find preset "es2015" relative to directory "/Users/jorgevenegas/Dev/Projects"

当然,我已经安装了react-native-cli。使用node v4.2.1,react-native 0.1.5,也安装了watchman和flow。

好像和babel有关。但我无法弄清楚原因。

我附上带有更详细输出的屏幕截图。

提前致谢!


这件事困扰了我整整一天。问题是我的文件层次结构中有一个 .babelrc 文件,它干扰了 babel 解析。摆脱了它,就很好了。 React-native 默认使用 es2015,因此不需要 .babelrc。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

react-native init 给出错误:找不到预设“es2015” 的相关文章

随机推荐