node.js - React-native 启动

标签 node.js react-native

按照初始设置的说明,当发现红屏时我卡住了:

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。

我怎样才能让它发挥作用?

最佳答案

  1. 安装 Node.js
  2. 打开命令提示符。
  3. 类型:react-native init 项目名称 此命令将自动下载项目所需的所有依赖项。
  4. 使用 cd projectname 从 cmd 打开目录
  5. react-native run-android

如果您遇到以下错误:请确保您安装了 npm。 然后执行这个命令 npm install --save

您的项目将成功运行。 希望它对你有用..

关于node.js - React-native 启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35362211/

相关文章:

react-native - 如何在 React Native 中持久化 Mobx 状态树?

javascript - 编译器不抛出 "Cannot find module"错误

javascript - Node 表达 JSON-Schema 多字段验证

node.js - 使用express循环 Mongoose 模式函数,将数据收集到数组中并最终使用所有数据渲染页面

python - 启动 node.js 脚本与 python 脚本的成本

node.js - NextJS 应用程序和 Express 服务器之间的内部 API 调用和通信

javascript - 仅在特定屏幕上渲染子组件中的按钮

javascript - 基于其他回调函数的函数...react-native

javascript - 如何从值设置 'ref'?

node.js - 将 Node.js 应用程序作为后台进程启动