2017-07-26 355 views
0

我安裝了Heroku CLI和git。安裝後,我重新啓動了命令提示符。當我運行git命令時,那些被認可很好。但是,當我輸入Heroku命令(例如heroku version)時,它們無法識別。安裝後Heroku CLI命令無法識別

所以我設置路徑變量指向Heroku安裝。現在,Heroku命令正在工作,但git命令已變得無法識別。

實際問題是什麼?

這裏是cmd提示內容。

Microsoft Windows [Version 6.1.7601] 
Copyright (c) 2009 Microsoft Corporation. All rights reserved. 

C:\Users\Deva 5>git config --list 
core.symlinks=false 
core.autocrlf=true 
core.fscache=true 
color.diff=auto 
color.status=auto 
color.branch=auto 
color.interactive=true 
help.format=html 
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt 
diff.astextplain.textconv=astextplain 
rebase.autosquash=true 
credential.helper=manager 
user.email=**** 
user.name=**** 
core.repositoryformatversion=0 
core.filemode=false 
core.bare=false 
core.logallrefupdates=true 
core.symlinks=false 
core.ignorecase=true 
core.hidedotfiles=dotGitOnly 
gui.wmstate=normal 
gui.geometry=888x427+150+150 171 192 

C:\Users\Deva 5>heroku version 
'heroku' is not recognized as an internal or external command, 
operable program or batch file. 

C:\Users\Deva 5>heroku login 
'heroku' is not recognized as an internal or external command, 
operable program or batch file. 

C:\Users\Deva 5>set path="C:\Program Files\Heroku\bin" 

C:\Users\Deva 5>heroku version 
heroku-cli: Updating to 6.13.1-7bcaf87... 11.6 MB/11.6 MB 
heroku-cli/6.13.1-7bcaf87 (windows-x64) node-v8.2.1 

C:\Users\Deva 5>git config --list 
'git' is not recognized as an internal or external command, 
operable program or batch file. 

回答

1
set path="C:\Program Files\Heroku\bin" 

通過這樣做,你更換 PATH變量以包含路徑。所以你基本上打破了一切。

你通常做的是在PATH變量的後面添加或預先加入新路徑,例如,像這樣:

set PATH=%PATH%;C:\Program Files\Heroku\bin 

永久的解決方案是編輯你的Windows默認包含到Heroku可執行文件的路徑。在超級用戶上看到這個問題的更多信息和說明:What are PATH and other environment variables, and how can I set or use them?

+0

謝謝@poke它正在工作 – Ash3317