错误在Windows上的React-natvie构建配置

时间:2015-11-19 08:56:44

标签: react-native

根据从这里获得的信息(https://facebook.github.io/react-native/docs/getting-started.html#content),我将踏上舞台。

但我遇到了一个问题。 当输入如下所示时出现问题。

react-native init ReactLog

在控制台窗口中,显示以下错误消息。

This will walk you through creating a new React Native project in F:\Android\Rea
ctLog
Installing react-native package from npm...

npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_mo
dules\which\which.js:78:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_mo
dules\which\which.js:82:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modul
es\which\which.js:93:16
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:82:15)
npm WARN addRemoteGit  facebook/react#b4e74e3 resetting remote C:\Users\Reddol\A
ppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-b4e74e3-
c92d21d2e268ee43029cdd9b3cd02392 because of error: { [Error: not found: git] cod
e: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\Reddol\AppData\Roaming\npm-cache\_git-rem
otes\_templates --mirror git://github.com/facebook/react.git C:\Users\Reddol\App
Data\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-b4e74e3-c9
2d21d2e268ee43029cdd9b3cd02392: undefined
npm ERR! git clone --template=C:\Users\Reddol\AppData\Roaming\npm-cache\_git-rem
otes\_templates --mirror git://github.com/facebook/react.git C:\Users\Reddol\App
Data\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-b4e74e3-c9
2d21d2e268ee43029cdd9b3cd02392: undefined
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_mo
dules\which\which.js:78:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_mo
dules\which\which.js:82:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modul
es\which\which.js:93:16
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:82:15)
npm WARN addRemoteGit  facebook/react#b4e74e3 resetting remote C:\Users\Reddol\A
ppData\Roaming\npm-cache\_git-remotes\git-https-github-com-facebook-react-git-b4
e74e3-7ac9f0e64c0248b5a8c1d179336b39d8 because of error: { [Error: not found: gi
t] code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\Reddol\AppData\Roaming\npm-cache\_git-rem
otes\_templates --mirror https://github.com/facebook/react.git C:\Users\Reddol\A
ppData\Roaming\npm-cache\_git-remotes\git-https-github-com-facebook-react-git-b4
e74e3-7ac9f0e64c0248b5a8c1d179336b39d8: undefined
npm ERR! git clone --template=C:\Users\Reddol\AppData\Roaming\npm-cache\_git-rem
otes\_templates --mirror https://github.com/facebook/react.git C:\Users\Reddol\A
ppData\Roaming\npm-cache\_git-remotes\git-https-github-com-facebook-react-git-b4
e74e3-7ac9f0e64c0248b5a8c1d179336b39d8: undefined
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_mo
dules\which\which.js:78:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_mo
dules\which\which.js:82:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modul
es\which\which.js:93:16
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:82:15)
npm WARN addRemoteGit  facebook/react#b4e74e3 resetting remote C:\Users\Reddol\A
ppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-b4e74e3-
a74af502d8e5579c42e0f6b0488923ce because of error: { [Error: not found: git] cod
e: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\Reddol\AppData\Roaming\npm-cache\_git-rem
otes\_templates --mirror git@github.com:facebook/react.git C:\Users\Reddol\AppDa
ta\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-b4e74e3-a74a
f502d8e5579c42e0f6b0488923ce: undefined
npm ERR! git clone --template=C:\Users\Reddol\AppData\Roaming\npm-cache\_git-rem
otes\_templates --mirror git@github.com:facebook/react.git C:\Users\Reddol\AppDa
ta\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-b4e74e3-a74a
f502d8e5579c42e0f6b0488923ce: undefined
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "react-native"
npm ERR! node v5.1.0
npm ERR! npm  v3.3.12
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!     F:\Android\ReactLog\npm-debug.log

`npm install --save react-native` failed

1 个答案:

答案 0 :(得分:0)

为Windows安装git工具(http://git-scm.com/download/win)并确保git.exe添加了PATH环境变量。