无法安装'react-navigation',导致GIT无法使用错误

时间:2018-04-06 07:44:00

标签: react-native npm npm-install yarnpkg

我想使用几个教程和官方文档中提到的react-navigation来使用您必须使用yarn或NPM安装它的反应导航。 我试过两个并得到同样的错误。

YARN

>yarn add react-navigation
yarn add v1.5.1
[1/4] Resolving packages...
error An unexpected error occurred: "Couldn't find the binary git".
info If you think this is a bug, please open a bug report with the information provided in "D:\\projects\\ReduxDemo\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

NPM

>yarn add react-navigation
yarn add v1.5.1
[1/4] Resolving packages...
error An unexpected error occurred: "Couldn't find the binary git".
info If you think this is a bug, please open a bug report with the information provided in "D:\\projects\\ReduxDemo\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

D:\projects\ReduxDemo>npm install --save react-navigation
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:14:12)
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:69:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:81:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:90:16
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\index.js:44:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:29:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:123:15)
npm WARN addRemoteGit  react-navigation/react-native-tab-view resetting remote C:\Users\AppData\Roaming\npm-cache\_git-remotes\git-github-com-react-navigation-react-native-tab-view-git-9747c439 because of error: { Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:14:12)
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:69:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:81:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:90:16
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\index.js:44:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:29:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:123:15) code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/react-navigation/react-native-tab-view.git C:\Users\AppData\Roaming\npm-cache\_git-remotes\git-github-com-react-navigation-react-native-tab-view-git-9747c439: undefined
npm ERR! git clone --template=C:\Users\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/react-navigation/react-native-tab-view.git C:\Users\AppData\Roaming\npm-cache\_git-remotes\git-github-com-react-navigation-react-native-tab-view-git-9747c439: undefined
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:14:12)
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:69:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:81:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:90:16
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\index.js:44:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:29:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:123:15)
npm WARN addRemoteGit  react-navigation/react-native-tab-view resetting remote C:\Users\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-react-navigation-react-native-tab-view-git-0c5c085d because of error: { Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:14:12)
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:69:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:81:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:90:16
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\index.js:44:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:29:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:123:15) code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror https://github.com/react-navigation/react-native-tab-view.git C:\Users\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-react-navigation-react-native-tab-view-git-0c5c085d: undefined
npm ERR! git clone --template=C:\Users\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror https://github.com/react-navigation/react-native-tab-view.git C:\Users\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-react-navigation-react-native-tab-view-git-0c5c085d: undefined
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:14:12)
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:69:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:81:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:90:16
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\index.js:44:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:29:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:123:15)
npm WARN addRemoteGit  react-navigation/react-native-tab-view resetting remote C:\Users\AppData\Roaming\npm-cache\_git-remotes\git-github-com-react-navigation-react-native-tab-view-git-b354594d because of error: { Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:14:12)
npm WARN addRemoteGit     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:69:19)
npm WARN addRemoteGit     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:81:29)
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:90:16
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\index.js:44:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:29:5
npm WARN addRemoteGit     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:123:15) code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git@github.com:react-navigation/react-native-tab-view.git C:\Users\AppData\Roaming\npm-cache\_git-remotes\git-github-com-react-navigation-react-native-tab-view-git-b354594d: undefined
npm ERR! git clone --template=C:\Users\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git@github.com:react-navigation/react-native-tab-view.git C:\Users\AppData\Roaming\npm-cache\_git-remotes\git-github-com-react-navigation-react-native-tab-view-git-b354594d: undefined
npm ERR! Windows_NT 10.0.16299
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "react-navigation"
npm ERR! node v6.11.4
npm ERR! npm  v3.10.10
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\ReduxDemo\npm-debug.log

4 个答案:

答案 0 :(得分:2)

前几天我遇到了同样的问题。我通过安装" Git"解决了这个问题。你可以在这里得到它:Git Download

安装时,您应该检查安装说明中的选项。这就像添加git到cmd或path。之后,您应该再次尝试安装导航包。它对我有用,但我不知道它是否适合你。

答案 1 :(得分:1)

您需要先安装 git ,并且 path

您可以使用git --version进行检查。

直到那时你可以直接引用 yarn add react-navigation@1.5.1获取特定版本

答案 2 :(得分:0)

我也遇到了同样的问题,它与您在项目中使用的其他版本的库发生冲突我使用的是react-native-image-picker.so它会出错。 因此,在安装以下版本时,它可以正常工作。

npm install --save react-navigation@1.0.0-beta.27

这解决了我的问题

答案 3 :(得分:0)

假设您已经安装了GIT,请转到要运行的目录,然后在此处右键单击git bash,然后运行命令。 它对我有用!