按照初始设置的说明,当发现红屏时我卡住了:
ReferenceError: Can't find variable: __fbBatchedBridge (line 1 in the generated bundle)
重新加载后,它会发生变化并变为:
Unable to download JS bundle
然后我找到了在控制台中输入react-native start的建议。结果:
react-native start
/local/react_native/android_program1/node_modules/react-native/local-cli/cli.js:74 const setupEnvScript = /^win/.test(process.platform) ^^^^^ SyntaxError: Use of const in strict mode. at Module._compile (module.js:439:25) at Module._extensions..js (module.js:474:10) at Object.require.extensions.(anonymous function) [as .js] (/local/react_native/android_program1/node_modules/react-native/node_modules/babel-core/node_modules/babel-register/lib/node.js:142:7) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/local/react_native/android_program1/node_modules/react-native/cli.js:15:18) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10)
我正在使用:
RHEL 7、npm 1.3.6、nodejs 0.10.36 和 React-native 0.19。
我怎样才能让它发挥作用?
最佳答案
- 安装 Node.js
- 打开命令提示符。
- 类型:react-native init 项目名称 此命令将自动下载项目所需的所有依赖项。
- 使用 cd projectname 从 cmd 打开目录
- react-native run-android
如果您遇到以下错误:请确保您安装了 npm。 然后执行这个命令 npm install --save
您的项目将成功运行。 希望它对你有用..
关于node.js - React-native 启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35362211/