1
2

More than 1 year has passed since last update.

WSL2 で VSCode 拡張機能 (Node.js) のテストコードを実行する

Posted at

概要

Node.js で VSCode 拡張機能を作ると、 npm run test でテストを実行できる。
このとき WSL2 上でいくつか生じるエラーがあるので、対処を残す。

環境

$ npm --version
8.11.0

$ node --version
v17.9.1

VSCode 1.71.2
Ubuntu 18.04
Windows 10 Pro

error while loading shared libraries: xxx

パッケージがインストールされていないので追加する。
xxx に出たパッケージをインストールすること。

sudo apt-get install libatk1.0-0
sudo apt-get install libatk-bridge2.0-0
sudo apt-get install libgtk3.0
sudo apt-get install libgbm
sudo apt-get install libgbm1
sudo apt-get install libasound2

Missing X server or $DISPLAY

記載の通り

  • VcxSrv をインストール
  • 設定画面の Additional parameters に -ac を追加
  • .bashrc に環境変数を追加
~/.bashrc
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
export LIBGL_ALWAYS_INDIRECT=true

VSCode を再起動すればエラーは消えるはず。

1
2
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
1
2