【问题标题】:git clone erron on react native how to resolve thisreact native 上的 git clone 错误如何解决
【发布时间】:2017-07-17 09:22:40
【问题描述】:

我正在尝试设置 react native 项目,但出现此错误如何解决此问题

npm WARN react-redux@5.0.5 requires a peer of react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0 but none was installed.
Installing dependencies using npm...

npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:13:12)
npm WARN addRemoteGit     at F (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:68:19)
npm WARN addRemoteGit     at E (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:80:29)
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:89:16
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\node_modules\isexe\index.js:42:5
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:36:5
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:152:21)
npm WARN addRemoteGit  expo/node-websql#18.0.0 resetting remote C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\git-github-com-expo-node-websql-git-18-0-0-17a6eb60 because of error: { Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:13:12)
npm WARN addRemoteGit     at F (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:68:19)
npm WARN addRemoteGit     at E (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:80:29)
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:89:16
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\node_modules\isexe\index.js:42:5
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:36:5
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:152:21) code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/expo/node-websql.git C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\git-github-com-expo-node-websql-git-18-0-0-17a6eb60: undefined
npm ERR! git clone --template=C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/expo/node-websql.git C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\git-github-com-expo-node-websql-git-18-0-0-17a6eb60: undefined
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:13:12)
npm WARN addRemoteGit     at F (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:68:19)
npm WARN addRemoteGit     at E (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:80:29)
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:89:16
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\node_modules\isexe\index.js:42:5
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:36:5
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:152:21)
npm WARN addRemoteGit  expo/node-websql#18.0.0 resetting remote C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-expo-node-websql-git-18-0-0-9423671b because of error: { Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:13:12)
npm WARN addRemoteGit     at F (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:68:19)
npm WARN addRemoteGit     at E (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:80:29)
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:89:16
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\node_modules\isexe\index.js:42:5
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:36:5
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:152:21) code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror https://github.com/expo/node-websql.git C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-expo-node-websql-git-18-0-0-9423671b: undefined
npm ERR! git clone --template=C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror https://github.com/expo/node-websql.git C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-expo-node-websql-git-18-0-0-9423671b: undefined
npm WARN addRemoteGit Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:13:12)
npm WARN addRemoteGit     at F (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:68:19)
npm WARN addRemoteGit     at E (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:80:29)
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:89:16
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\node_modules\isexe\index.js:42:5
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:36:5
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:152:21)
npm WARN addRemoteGit  expo/node-websql#18.0.0 resetting remote C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\git-github-com-expo-node-websql-git-18-0-0-8213877d because of error: { Error: not found: git
npm WARN addRemoteGit     at getNotFoundError (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:13:12)
npm WARN addRemoteGit     at F (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:68:19)
npm WARN addRemoteGit     at E (C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:80:29)
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\which.js:89:16
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\node_modules\isexe\index.js:42:5
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:36:5
npm WARN addRemoteGit     at C:\Users\VA\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
npm WARN addRemoteGit     at FSReqWrap.oncomplete (fs.js:152:21) code: 'ENOGIT' }
npm ERR! git clone --template=C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git@github.com:expo/node-websql.git C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\git-github-com-expo-node-websql-git-18-0-0-8213877d: undefined
npm ERR! git clone --template=C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git@github.com:expo/node-websql.git C:\Users\VA\AppData\Roaming\npm-cache\_git-remotes\git-github-com-expo-node-websql-git-18-0-0-8213877d: undefined
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! A complete log of this run can be found in:
npm ERR!     C:\Users\VA\AppData\Roaming\npm-cache\_logs\2017-07-17T09_17_53_803Z-debug.log
`npm install --save` failed

【问题讨论】:

  • 这不是 git clone 错误,这是 npm install 错误。您可能缺少 git 可执行文件(或者它在您的 PATH 中未正确定义)

标签: javascript node.js react-native npm


【解决方案1】:

确保您已在您的机器中安装 GIT,如果没有,请在此处获取副本 => https://git-scm.com/downloads 并根据您的环境下载/安装。

如果您已经有任何其他 git 客户端(如 SmartGit、TortoiseGIT 或 SourceTree),您可以使用以下命令设置指向便携式 git 的路径。

set path=%PATH%;YOUR_GIT_PATH

希望这会有所帮助!

【讨论】:

    【解决方案2】:

    我遇到了同样的问题——就我而言,它与 Cygwin 有关。安装脚本需要以c:\ 开头的绝对路径,但在Cygwin 环境中,这将类似于/cygdrive/c/。所需路径无法解析,安装失败。

    在这种情况下,解决方案很简单:退出 Cygwin 并为 npm i 使用标准 shell。

    【讨论】:

      猜你喜欢
      • 2017-09-25
      • 2020-01-26
      • 2021-03-09
      • 2020-06-29
      • 2021-06-17
      • 1970-01-01
      • 1970-01-01
      • 2018-12-25
      • 1970-01-01
      相关资源
      最近更新 更多