javascript - React Native "run-ios"意外的 token

标签 javascript reactjs react-native unexpected-token

我正在尝试重新安装 React Native。它工作正常,但是当我重新安装它时,它显示构建 IOS 应用程序时出现一些错误。

我使用安装了react-native

npm install -g react-native-cli

然后创建新项目

react-native init GM

成功,现在版本如下

node --version
v8.11.2
npm --version
5.6.0
react-native --version
react-native-cli: 2.0.1
react-native: 0.55.4

然后我尝试了

react-native run-ios

它显示错误

node_modules/@babel/core/lib/transformation/file/file.js:63   constructor(options, {
                       ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Module._extensions..js (module.js:422:10)
    at Object.require.extensions.(anonymous function) [as .js] (/reactNative/GM/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/reactNative/GM/node_modules/@babel/core/lib/index.js:147:36)
    at Module._compile (module.js:413:34) Process terminated. Press <enter> to close the window

我正在执行与ReactNative中提到的相同步骤

提前致谢

最佳答案

升级 Node 和 NPM 为我解决了这个问题。

关于javascript - React Native "run-ios"意外的 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50678512/

相关文章:

javascript - 如何在 jQuery 中对文本产生闪光效果?

angular - 创建 Angular/React 应用程序时的 .Net 本地主机服务器

javascript - 从函数返回 JSX

javascript - 如何在我的 React Native 应用程序中添加 NativeBase 页脚?

javascript - 无法使用 React Native 将图像上传到 wp/v2/media

javascript - 页面重新加载时不显示动态内容

javascript - Angular Directive(指令)链接函数中的 "attrs"参数有什么用

javascript - 正则表达式检测仅由连字符分隔的任意数量的数字

javascript - 使用语义 UI 动态渲染 react 列表

android - 我们可以使用 altbeacon 获得监视信标的 eddystone uid 吗?