“코드” OSX / Mac의 Visual Studio Code 명령 행에서 작동하지 않음
"code"명령 이 매뉴얼 에서는 작동하지 않습니까?
그 전에 다른 모든 단계가 작동했습니다. OSX 터미널에서 Visual Studio Code를 어떻게 호출 할 수 있습니까?
Monas-MacBook-Pro:myExpressApp mona$ pwd
/Users/mona/nodejs/myExpressApp
Monas-MacBook-Pro:myExpressApp mona$ code .
-bash: code: command not found
편집 : 작업 영역을 변경하여 Visual Code Studio에서 열어 보았지만 왜 "code"명령인지 궁금합니다. 작동하지 않습니까?
설치 후 VS Code를 시작하십시오.
이제 명령 팔레트 (⇧⌘P)를 열고 'shell command'를 입력하여 Shell Command : PATH 명령 에 'code'명령을 설치하십시오 .
명령을 실행 한 후 새 $ PATH 값을 적용하려면 터미널을 다시 시작하십시오. 단순히 'code'를 입력 할 수 있습니다. 해당 폴더의 파일 편집을 시작하려면 모든 폴더에서. "." 단순히 "현재 디렉토리"를 의미
(출처 : VS Code documentation )
Mac 사용자를위한 추가 참고 사항 :
감사합니다 @JasonGalvin
Visual Studio Code 앱을 Applications 폴더로 드래그하십시오. 그렇지 않으면 @uloco가 말했듯이 재부팅 후이 프로세스를 다시 수행해야합니다
영구적으로 추가하려면 다음을 수행하십시오.
이것을 ~ / .bash_profile에 추가하십시오
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
출처 : https://code.visualstudio.com/docs/setup/mac
~/.bashrc사용 하여 파일을여십시오vi/vim $ vi ~/.bashrc
를 눌러 i삽입 하여 다음을 입력하십시오 .
code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}
파일을 사용하여 저장 :wq
~/.bashrc다음 명령 을 사용하여 설정을 반영하십시오 .
source ~/.bashrc
https://code.visualstudio.com/Docs/setup
팁 : 터미널에서 VSCode를 실행하려면 .bashrc 파일에 다음을 추가하십시오.
code () {
if [[ $# = 0 ]]
then
open -a "Visual Studio Code"
else
[[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}"
open -a "Visual Studio Code" --args "$F"
fi
}
그런 다음 $ source ~ / .bashrc
Iterm2와 함께 ZShell을 실행하는 사람들을 위해 이것을 ~/.zshrc파일에 추가 하십시오.
alias code="/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code"
PATH에 'code'를 설치하기 위해 설명서를 따르는 것은 매우 간단하지만 작동하지 않았습니다.
나는 단순히 먼저 다음 다시 설치 제거.
명령 팔레트를 엽니 다 (⇧⌘P)
Shell Command: Uninstall 'code' command in PATH command.
그런 다음 다시 설치하십시오.
Shell Command: Install 'code' command in PATH command.
새 PATH를 포함 시키려면 터미널을 다시 시작해야합니다.
이를 위해서는 bash 경로에 'code'라는 실행 파일이 있어야합니다. 일부 설치 관리자가 추가하지만이 파일은 그렇지 않습니다. 이를 수행하는 가장 좋은 방법은 /usr/local/bin폴더 의 Visual Studio 코드 앱에 심볼릭 링크를 추가하는 것 입니다. 터미널에서 다음과 같은 명령을 사용하여이를 수행 할 수 있습니다.
ln -s "/Path/To/Visual Studio Code" "/usr/local/bin/code"
당신은 가능성이 넣을 필요가 sudo성공적으로 완료 할 권한을 가지고 그 앞에.
내 MAC에서 작동합니다.
.bash_profile에 추가
code() {
open -a Visual\ Studio\ Code.app $1
}
저장하고 터미널 'source .bash_profile'에
그런 다음 터미널 코드 index.html (또는 무엇이든)에서 VS 코드로 해당 파일을 엽니 다.
어리석게도 /usr/local/bin/code심볼릭 링크를 삭제 하고 올바른 경로를 몰랐습니다. 양조장 재설치가 다시 작성했습니다.
brew cask reinstall visual-studio-code
경로는 다음과 같습니다.
/usr/local/bin/code ->
'/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code'
명령 팔레트 솔루션 사용에 문제 가있는 경우 터미널을 시작할 때 환경 변수에 VS 코드 를 수동으로 추가 할 수 있습니다 $PATH.
cat << EOF >> ~/.bash_profile
# Add Visual Studio Code (code)
export PATH="$PATH:/Applications/Visual Studio
Code.app/Contents/Resources/app/bin"
EOF
Mac OSX의 경우 : Brew-Cask를 통해 Visual Studio Code를 설치하는 방법이 있습니다.
- 먼저 여기 에서 'Homebrew'를 설치 하십시오 .
이제 다음 명령을 실행하면 Mac에 최신 Visual Studio Code가 설치됩니다.
$> 맥주 통 비주얼 스튜디오 코드 설치
위의 명령은 Visual Studio Code를 설치하고 Visual Studio Code의 명령 줄 호출을 설정해야합니다.
위의 단계가 작동하지 않으면 수동으로 수행 할 수 있습니다. 여기에 제공된 Microsoft Visual Studio Code 설명서를 따릅니다 .
커맨드 라인 솔루션의 대안 :
최근에 Mac OS X에서 서비스를 가지고 놀았습니다. Visual Studio Code에서 해당 폴더 나 파일을 열 수 있도록 폴더 나 파일에 서비스를 추가했습니다. 나는 이것이 'code'를 사용하는 대안이 될 수 있다고 생각합니다. Finder 앱을 사용하는 경우 명령. 단계는 다음과 같습니다.
- 응용 프로그램에서 Automator 앱을 엽니 다. 또는 Spotlight를 사용할 수 있습니다.
- '새 문서'버튼을 클릭하여 새 스크립트를 만듭니다.
- 새로운 유형의 문서로 '서비스'를 선택하십시오.
- '서비스 수신 선택'드롭 다운에서 '파일 및 폴더'를 선택하십시오.
- '파인더 항목 열기'조치 항목을 검색하십시오.
- 해당 작업 항목을 워크 플로 영역으로 끕니다.
- '열기'작업 드롭 다운에서 'Visual Studio Code.app'응용 프로그램을 선택하십시오.
- 'command + s'를 눌러 서비스를 저장하십시오. 서비스 이름을 물어볼 것입니다. 이름을 알려주세요. 나는 'VSCode로 열기'를주었습니다. Automator 앱을 닫습니다. 자세한 내용은 아래 이미지를 확인하십시오.
확인:
- Finder 앱을 엽니 다.
- 아무 폴더 나 마우스 오른쪽 버튼으로 클릭하십시오.
- 상황에 맞는 메뉴에서 'VSCode로 열기'메뉴 옵션을 찾으십시오.
- 'VSCode로 열기'메뉴 옵션을 클릭하십시오.
- 폴더가 Visual Studio Code 응용 프로그램에서 열립니다. 자세한 내용은 아래 이미지를 확인하십시오.
'code'입니다. 여기에 설명 된대로 OSX 터미널 추가 코드에서 작동하려면 https://code.visualstudio.com/Docs/setup 하지만 OSX에서는 '.bashrc'대신 터미널 세션 시작시로드되는 '.profile'을 시도하십시오.
EDIT: If this is happening on mint/ubuntu, it is likely because you installed vscode through the software manager. This will cause other problems during debugging. Instead install it using the .deb file on the vscode website.
If you really want to use the software manager, the solution below still works:
use find / -name code 2> /dev/null to find the path to the visual studio bin file. It should end in /extra/vscode/bin/code
If you're using the mint software manager, you might only find paths with a ridiculously long name in the middle like this:
".../stable/7a22830d9e8fbbdc9627e43e072005eef66c14d2a4dd19992427ef4de060186a/..."
Just replace the long part with "/active/"
Once you have it, create a sym link:
ln -s path_you_found/extra/vscode/bin/code /usr/local/bin/code
If you don't have the rights, or only want it to be accessible for yourself, simply add this line to your .bashrc / .zshrc:
export PATH="$PATH:path_you_found/extra/vscode/bin/
Note that I removed the 'code' filename at the end
Define the path of the Visual Studio in your ~/.bash_profile as follow
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
for the people who face the same problem in Windows - 10 please follow the below instructions,
https://github.com/Microsoft/vscode/issues/21957
It might be the case that, C:\Program Files (x86)\Microsoft VS Code\bin is missing in environment variables., kindly look into the following image for the solution, https://cloud.githubusercontent.com/assets/4076309/23575794/61d7cc2a-00b9-11e7-843b-bcd6f00f595f.png
If you are on Windows and facing the same problem, have a look at this answer of @Inazense https://stackoverflow.com/a/52869803/4567504.
Visual Studio 코드에서 "쉘 명령 : PATH 명령에 'code'명령 설치" 를 찾을 수 없습니다 . 수동으로해야했습니다.
- 시스템 변수에서 환경 변수 (시스템> 고급 시스템 설정> 고급 탭> 환경 변수)를 열고 경로를 클릭 한 후 편집을 클릭하고 이름이 지정된 새 경로를 추가하십시오.
"C : \ Users \ Your_Username \ AppData \ Local \ Programs \ Microsoft VS Code \ bin"
이제 끝났습니다! 명령 프롬프트를 다시 시작하고 다시 시도하십시오.
'development' 카테고리의 다른 글
| HTML 엔터티 디코딩 (0) | 2020.04.17 |
|---|---|
| Swift에서 UILabel의 글꼴 크기를 어떻게 변경합니까? (0) | 2020.04.17 |
| 제목없는 UINavigationBar 사용자 정의 뒤로 버튼 (0) | 2020.04.17 |
| XML에서 C # 클래스 생성 (0) | 2020.04.17 |
| rvm 설치가 작동하지 않습니다 :“RVM이 기능하지 않습니다” (0) | 2020.04.17 |


