首页 > react-native init AsomeProject 失败

react-native init AsomeProject 失败

我是在window下搭建react-native的环境的,在创建一个项目的时候出现了如下错误
I:\react>react-native init Jojo
This will walk you through creating a new React Native project in I:\react\Jojo
Installing react-native package from npm...

npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit at F (I:\nodejs\node_modules\npm\node_modules\which\wh
ich.js:73:28)
npm WARN addRemoteGit at E (I:\nodejs\node_modules\npm\node_modules\which\wh
ich.js:76:29)
npm WARN addRemoteGit at I:\nodejs\node_modules\npm\node_modules\which\which
.js:84:16
npm WARN addRemoteGit at FSReqWrap.oncomplete (fs.js:82:15)
npm WARN addRemoteGit git://github.com/facebook/react.git#b4e74e38e43ac53af8acd
62c78c9213be0194245 resetting remote C:\Users\梓健\AppData\Roaming\npm-cache_gi
t-remotes\git-github-com-facebook-react-git-baa2986b because of error: { [Error:
not found: git] code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\梓健\AppData\Roaming\npm-cache_git-remot
es_templates --mirror git://github.com/facebook/react.git C:\Users\梓健\AppData
\Roaming\npm-cache_git-remotes\git-github-com-facebook-react-git-baa2986b: unde
fined
npm ERR! git clone --template=C:\Users\梓健\AppData\Roaming\npm-cache_git-remot
es_templates --mirror git://github.com/facebook/react.git C:\Users\梓健\AppData
\Roaming\npm-cache_git-remotes\git-github-com-facebook-react-git-baa2986b: unde
fined
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "I:\\nodejs\\node.exe" "I:\\nodejs\\node_modules\\npm\\bin\\npm-cl
i.js" "install" "--save" "react-native"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ENOGIT

npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! Please include the following file with any support request:
npm ERR! I:\react\Jojo\npm-debug.log

npm install --save react-native failed

错误提示没有找到git,但是我已经安装了git,怎么会这样????


请问你这个问题解决了吗?是什么原因啊?怎么搞?谢谢


这个问题暂时无解。
解决办法,安装虚拟机,然后虚拟机装mac操作系统。然后mac上装开发环境。可以开发后在与虚拟机相联的真机上调试。
电脑要至少i5CPU,8G内存。CPU越强越好,内存16G最好(再多也不需要了)。


同样是这个问题啊


React Native 官方暂时没有支持 Windows 平台。

实际上要在 Windows 上使用似乎需要折腾一下,可以参考下面这个链接:

在Windows下搭建React Native Android开发环境


看这里,有另一种方法:https://coderwall.com/p/suvorq/beginning-react-native


git木有放到环境变量里吧,windows下记得是要自己设的吧。

【热门文章】
【热门文章】