2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

WSLで`code .'などでVScodeが起動できない場合の設定

Last updated at Posted at 2022-05-21

前提

  • OS: Windows 11 Pro 21H2 22000.675
  • WSL: カーネルバージョン: 5.10.102.1
  • ディストリビューション: CentOS Stream release 8
  • VSCode: 1.67.2

現象

Windows 11でVSCodeをインストールしてある状態で、WSL上のCentOSにおいて、code .コマンドでカレントディレクトリを起点としたVSCodeの新しい窓を起動したいが、codeのコマンドを入力しても"command not found"になり、VSCodeが起動しない。

$ code .
-bash: code: command not found

解決法

以下を"~/.bashrc"に追記

~/.bashrc
# for vscode
export PATH=/mnt/c/Users/<貴方のユーザーのフォルダ名>/AppData/Local/Programs/Microsoft\ VS\ Code/bin:$PATH

やりがちなミス

適用をお忘れなく

source ~/.bashrc
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?