本文主要是介绍WindowS 下React native 配置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1,下载:https://github.com/facebook/react-native
2,解压:
cmd命令:
安装:
C:\Users\22945>npm install -g react-native-cli
npm WARN engine react-native-cli@1.3.0: wanted: {“node”:”>=4”} (current: {“node”:”0.12.2”,”npm”:”2.7.4”})
C:\Users\22945\AppData\Roaming\npm\react-native -> C:\Users\22945\AppData\Roaming\npm\node_modules\react-native-cli\index.js
react-native-cli@1.3.0 C:\Users\22945\AppData\Roaming\npm\node_modules\react-native-cli
├── semver@5.3.0
├── minimist@1.2.0
├── chalk@1.1.3 (escape-string-regexp@1.0.5, supports-color@2.0.0, ansi-styles@2.2.1, strip-ansi@3.0.1, has-ansi@2.0.0)
└── prompt@0.2.14 (revalidator@0.1.8, pkginfo@0.4.0, read@1.0.7, winston@0.8.3, utile@0.2.1)
初始化:
C:\Users\22945>react-native init reactNative
C:\Users\22945\AppData\Roaming\npm\node_modules\react-native-cli\index.js:152
const rnPackage = argv.version;
^^^^^
//报错:
SyntaxError: Use of const in strict mode.
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
原因:node.js版本太低,下载最新版本:msi
https://nodejs.org/en/download/
双击安装:
node.js安装步骤:
http://jingyan.baidu.com/article/b0b63dbfca599a4a483070a5.html
重新init react native
http://www.cnblogs.com/unofficial/p/4843734.html
这篇关于WindowS 下React native 配置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!