简体   繁体   English

反应本机启动

[英]React-native start

Following the instructions for initial setup I stucked when found a red screen with: 按照初始设置的说明,发现出现红色屏幕时,我卡住了:

ReferenceError: Can't find variable: __fbBatchedBridge (line 1 in the generated bundle) ReferenceError:找不到变量:__fbBatchedBridge(生成的包中的第1行)

After reloading it changes and becomes: 重新加载后,它会变为:

Unable to download JS bundle 无法下载JS捆绑包

Than I found an advice for typing react-native start into the console. 然后,我发现了在控制台中键入react-native start的建议。 The result: 结果:

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. /local/react_native/android_program1/node_modules/react-native/local-cli/cli.js:74 const setupEnvScript = /^win/.test(process.platform)^^^^^ SyntaxError:在严格模式下使用const。 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. 在Module._compile(module.js:439:25)在Module._extensions..js(module.js:474:10)在Object.require.extensions。(匿名函数)[作为.js](/ local / react_native /android_program1/node_modules/react-native/node_modules/babel-core/node_modules/babel-register/lib/node.js:142:7)在Function.Module._load的Module.load(module.js:356:32) (module.js:312:12)出现在Module.require(module.js:364:17)出现在Object的require(module.js:380:17)出现了。 (/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) (/local/react_native/android_program1/node_modules/react-native/cli.js:15:18)在Object.Module._extensions..js(module.js:474)上的Module._compile(module.js:456:26) :10)

I'm using: 我正在使用:

RHEL 7, npm 1.3.6, nodejs 0.10.36 and react-native 0.19. RHEL 7,npm 1.3.6,nodejs 0.10.36和react-native 0.19。

How can I make it work? 我该如何运作?

  1. install node js 安装节点js
  2. open command promt. 打开命令提示。
  3. type: react-native init projectName this command will automatically download all the required dependancies for project. 类型:react-native init projectName此命令将自动下载项目所需的所有依赖关系。
  4. open the directory from cmd using cd projectname 使用cd projectname从cmd打开目录
  5. react-native run-android react-native运行Android

if u face the error like : make sure you have npm install. 如果您遇到以下错误:确保已安装npm。 then just exicute this command npm install --save 然后只是执行此命令npm install --save

your project will run successfully. 您的项目将成功运行。 hope it work for you.. 希望它为您工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM