CreateProcess错误= 2,系统找不到指定的文件错误 [英] CreateProcess error = 2, the system cannot find the file specified error

查看:680
本文介绍了CreateProcess错误= 2,系统找不到指定的文件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上有Android Studio 2.3.3,在Windows上也有Git.我从GitHub克隆了一个存储库(VCS-> Checkout from version control-> Git->粘贴了链接)并尝试运行它.但是gradle同步失败,提示此错误

I have Android Studio 2.3.3 on Windows and also Git for Windows. I cloned a repository from GitHub ( VCS->Checkout from version control->Git->pasted the link ) and tried to run it. But the gradle sync failed giving this error

CreateProcess error=2, the system cannot find the file specified  

我检查了日志,并注意到了

I checked the log and I noticed this

java.io.IOException: Cannot run program "git" (in directory "H:\GitClone\apps-android-commons\app"): CreateProcess error=2, The system cannot find the file specified

给出的路径是我在结帐时选择的位置.
我尝试在Android Studio中将git.exe的路径从... \ bin \ git.exe更改为... \ cmd \ git.exe.
我还将git.exe的路径添加到我的环境PATH变量中,但是错误仍然存​​在.
关于SO的其他答案大多告诉执行这些步骤,但是由于我已经完成了这些操作,因此我不得不提出一个新问题.
另外,我的朋友建议我安装Github Desktop,但我不能安装,因为我有32位操作系统.
注意-我是版本控制的新手.
编辑-日志的一部分

The path given is the location I chose during checkout.
I tried changing the path for git.exe from ...\bin\git.exe to ...\cmd\git.exe in Android Studio.
I also added the path for git.exe to my environment PATH variables but the error has persisted.
Other answers on SO mostly tell to do these steps but as I had already done these I had to ask a new question.
Also, my friend advised me to install Github Desktop but I cannot because I have a 32 bit OS.
Note- I am completely new to version control.
Edit - A part of the log

Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'git''
at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:220)
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:204)
at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:340)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86)
at org.gradle.internal.operations.BuildOperationIdentifierPreservingRunnable.run(BuildOperationIdentifierPreservingRunnable.java:39)
... 3 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'git'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
... 4 more

推荐答案

确保将 git.exe 添加到PATH:在Android Studio中,您需要指定完整的路径,包括 git.exe ,则只需在 PATH 中添加 git.exe 的父文件夹:

Make sure how you add git.exe to your PATH: while in Android studio yo need to specify the full path including git.exe, you would need to add only the parent folder of git.exe in your PATH:

set PATH=C:\path\to\Git\bin;%PATH%

C:\ path \ to \ Git可以是您解压缩sef提取的存档

C:\path\to\Git can be any folder where you uncompressed the sef-extracted archive PortableGit-2.15.1-64-bit.7z.exe.

需要在您的USER Environment变量中完成,并且您需要关闭并重新打开Android Studio您希望从中启动任何进程(例如Gradle)来继承新的%PATH%值.

That needs to be done in your USER Environment variables, and you need to close and re-open Android Studio if you want any process (like Gradle) launch from it to inherit your new %PATH% value.

这篇关于CreateProcess错误= 2,系统找不到指定的文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆