【发布时间】:2016-09-10 20:00:12
【问题描述】:
我必须禁用 nvm 并通过 brew 安装 node-6.0.0 才能在我的 iOS 设备上使用 9.3.1 获得全新的、未更改的 RN 应用程序。
无论我做什么,mainjs.bundle 都不会重新创建。我将 Schema 从 Debug 切换到 Release 并更改 AppDelegate.m 以便从包中读取 JS,而不是从服务器中读取。但是在我编译应用程序的那一刻,我收到以下错误:
+ DEST=/Users/foobar/Library/Developer/Xcode/DerivedData/TestSome-fpsorufynyrzmuceyzbnallqkbrd/Build/Products/Release-iphonesimulator/TestSome.app
+ node /Users/foobar/tmp/reacttest/TestSome/node_modules/react-native/local-cli/cli.js bundle --entry-file index.ios.js --platform ios --dev false --bundle-output /Users/foobar/Library/Developer/Xcode/DerivedData/TestSome-fpsorufynyrzmuceyzbnallqkbrd/Build/Products/Release-iphonesimulator/TestSome.app/main.jsbundle --assets-dest /Users/foobar/Library/Developer/Xcode/DerivedData/TestSome-fpsorufynyrzmuceyzbnallqkbrd/Build/Products/Release-iphonesimulator/TestSome.app
/Users/foobar/tmp/reacttest/TestSome/node_modules/react-native/local-cli/cli.js:123
class CreateSuppressingTerminalAdapter extends TerminalAdapter {
^^^^^
SyntaxError: Unexpected reserved word
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Command /bin/sh failed with exit code 1
在我看来,6to2 转译由于某种原因失败了。如果我注释掉该类并将其删除,在它使用的地方,会出现下一个错误,在某处抱怨未知关键字const。
如果我通过以下方式手动构建 mainjs.bundle:
react-native bundle --dev false --minify --entry-file ./index.ios.js --platform ios --bundle-output ios/main.jsbundle
我可以在我的设备上安装该应用程序。但是我require()的图片等额外资源没有捆绑。
谁能告诉我,我可以在哪里寻找问题?
【问题讨论】:
标签: ios node.js xcode react-native ecmascript-6