0

I followed the React native official docs step by step, but as soon as I executed the command react-native init MedFirstRN from windows cmd, I received the following error:

D:\projects>react-native init MedFirstRN
This will walk you through creating a new React Native project in D:\projects\MedFirstRN
Installing react-native package from npm...

npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at F (C:\android\nodejs\node_modules\npm\node_modules\which\which.js:73:28)
npm WARN addRemoteGit     at E (C:\android\nodejs\node_modules\npm\node_modules\which\which.js:76:29)
npm WARN addRemoteGit     at C:\android\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#b4e74e38e43ac53af8acd62c78c9213be0194245 resetting remote C:\Users\Moughaoui\AppData\Roaming\npm-cache\_git-r
emotes\git-github-com-facebook-react-git-b4e74e38e43ac53af8acd62c78c9213be0194245-c92d21d2e268ee43029cdd9b3cd02392 because of error: { [Error: not found: git] code: 'EN
OGIT' }
npm ERR! git clone --template=C:\Users\Moughaoui\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/facebook/react.git C:\Users\Moughaoui\AppDa
ta\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-b4e74e38e43ac53af8acd62c78c9213be0194245-c92d21d2e268ee43029cdd9b3cd02392: undefined
npm ERR! git clone --template=C:\Users\Moughaoui\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/facebook/react.git C:\Users\Moughaoui\AppDa
ta\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-b4e74e38e43ac53af8acd62c78c9213be0194245-c92d21d2e268ee43029cdd9b3cd02392: undefined
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\android\\nodejs\\node.exe" "C:\\android\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "react-native"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.6
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!     D:\projects\MedFirstRN\npm-debug.log

`npm install --save react-native` failed

D:\projects>

Can you help please?

When I execute this command from Git Shell it works.

Pang
  • 9,564
  • 146
  • 81
  • 122
GOOD_MED
  • 3
  • 1
  • 3
  • Crazy... Looks like you're on windows, so I'm probably not going to be much help... but maybe try installing git again for starters. – Chris Geirman Oct 31 '15 at 02:46

1 Answers1

1

Make sure to install git with Run Git from Windows Command Prompt option selected. This option will add the git executable to your PATH which seems to be missing and causing this error.

Check this answer https://stackoverflow.com/a/21614660/157575 for more details.

Community
  • 1
  • 1
Amitava
  • 108
  • 1
  • 7