[誰か助けて]Spring Tools 4 for Theiaがすんなりインストールして使えない件
[公式ドキュメントのインストール手順](https://github.com/spring-projects/sts4/wiki/Installation#theia)に沿って、進めるんだがすんなり行かないで夏休みの2日を費やしている。。。
公式に載ってるインストール手順
1. STS 4 repo をクローンする
1. concourse/theia-docker-imageフォルダに移動
1. VSCode Extensions Downloads pageで STS 4 vscode extensionsをダウンロードしてpluginsフォルダに格納する
1. `$ docker build -t my-theia-sts4 .` 左記コマンドを実行してdockerイメージを作成する
1. `docker run -it --init -p 3000:3000 -p 8080:8080 -v "$(pwd):/home/project:cached" my-theia-sts4`を実行して、Theiaを起動する
たったこれだけのはずなんだが・・・
WSL2の有効化
dockerコマンドでコケてしまうので、とりあえずWSLをインストールしてみた。
MicrosoftStoreでUbuntu22.04.x LTSを入手
![](https://assets.st-note.com/img/1660892917990-8lQUGPMpz1.png?width=1200)
docker desktopの設定でubuntuを有効にする
![](https://assets.st-note.com/img/1660892926939-5N8tDI8bHW.png?width=1200)
docker buildの最後でエラーが出てしまう罠。結構時間かかったんだが・・・・
![](https://assets.st-note.com/img/1660893020040-XQ1qpyrwa2.png?width=1200)
Step 11/14 : RUN yarn --cache-folder ./ycache && rm -rf ./ycache && NODE_OPTIONS="--max_old_space_size=8192" yarn theia build ; yarn theia download:plugins
---> Running in f00c859cd47e
yarn install v1.22.19
info No lockfile found.
[1/4] Resolving packages...
warning Resolution field "vscode-languageserver-types@3.15.0-next.5" is incompatible with requested version "vscode-languageserver-types@3.16.0-next.2"
warning vscode-languageserver > vscode-textbuffer@1.0.0: This package has been renamed to @vscode/textbuffer, please update to the new name
warning Resolution field "vscode-languageserver-protocol@3.15.0-next.9" is incompatible with requested version "vscode-languageserver-protocol@~3.15.3"
warning @theia/editor-preview > @theia/navigator > @theia/filesystem > trash > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
warning @theia/editor-preview > @theia/navigator > @theia/filesystem > trash > xdg-trashdir > @sindresorhus/df > execa > cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
warning @theia/editor-preview > @theia/core > @theia/application-package > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning @theia/editor-preview > @theia/core > @theia/application-package > request > uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
warning @theia/editor-preview > @theia/core > @theia/application-package > request > har-validator@5.1.5: this library is no longer supported
warning @theia/git > dugite-extra > dugite-no-gpl > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning @theia/json@1.3.0: Package no longer supported. Use at your own risk
warning Resolution field "vscode-languageserver-protocol@3.15.0-next.9" is incompatible with requested version "vscode-languageserver-protocol@3.15.3"
warning @theia/plugin-ext > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning @theia/plugin-ext > vscode-debugprotocol@1.51.0: This package has been renamed to @vscode/debugprotocol, please update to the new name
warning @theia/plugin-ext > @theia/debug > vscode-debugprotocol@1.51.0: This package has been renamed to @vscode/debugprotocol, please update to the new name
warning @theia/plugin-ext-vscode > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning @theia/cli > mocha > debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
warning @theia/cli > puppeteer@2.1.1: Version no longer supported. Upgrade to @latest
warning @theia/cli > mocha > chokidar > fsevents@2.1.3: "Please update to latest v2.3 or v2.2"
warning Resolution field "vscode-languageserver-types@3.15.0-next.5" is incompatible with requested version "vscode-languageserver-types@3.16.0-next.2"
[2/4] Fetching packages...
error ts-md5@1.3.1: The engine "node" is incompatible with this module. Expected version ">=12". Got "10.24.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
yarn run v1.22.19
error Command "theia" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command '/bin/sh -c yarn --cache-folder ./ycache && rm -rf ./ycache && NODE_OPTIONS="--max_old_space_size=8192" yarn theia build ; yarn theia download:plugins' returned a non-zero code: 1
error ts-md5@1.3.1: The engine "node" is incompatible with this module. Expected version ">=12". Got "10.24.1"
nodeのバージョンが低いってどういう事よ・・・・
なぜデフォルトのDockerfileがエラーになるのと愚痴が止まらない・・・
![](https://assets.st-note.com/img/1660893230510-HiaupAeA06.png?width=1200)
Dockerfileみたら、それっぽい記述があったので、ひとまず10を12に変えてみた。
![](https://assets.st-note.com/img/1660893661695-SWkseRZAYa.png?width=1200)
#5 259.1 Get:258 http://archive.ubuntu.com/ubuntu bionic/main amd64 manpages-dev all 4.15-1 [2217 kB]
#5 265.4 Get:259 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 openjdk-8-jre amd64 8u342-b07-0ubuntu1~18.04 [69.6 kB]
#5 265.5 Get:260 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 openjdk-8-jdk-headless amd64 8u342-b07-0ubuntu1~18.04 [8300 kB]
#5 288.3 Get:261 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 openjdk-8-jdk amd64 8u342-b07-0ubuntu1~18.04 [4032 kB]
#5 299.0 Fetched 164 MB in 3min 58s (690 kB/s)
#5 299.0 E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/libc-dev-bin_2.27-3ubuntu1.6_amd64.deb Undetermined Error [IP: 91.189.91.39 80]
#5 299.0 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
------
executor failed running [/bin/sh -c apt-get update && apt-get install -y build-essential gettext-base git jq openjdk-8-jdk curl]: exit code: 100
なんでやねん、さっきより手前でエラーになる罠・・・
[Failed to fetch security undetermined error [IP: 91.189.91.38 80] in Ubuntu 20.04](https://askubuntu.com/questions/1305141/failed-to-fetch-security-undetermined-error-ip-91-189-91-38-80-in-ubuntu-20-0)
上記サイトを参考にして、Dockerfileに`apt clean && apt autoclean`を追加してみる。どんどんDockerfileが変わるんだが・・・
![](https://assets.st-note.com/img/1660894082095-CPRiE2oxfW.png?width=1200)
![](https://assets.st-note.com/img/1660894637821-ZT8HsyRHfq.png?width=1200)
docker build -t my-theia-sts .
[+] Building 652.5s (16/16) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.01kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:18.04 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 314B 0.0s
=> CACHED [ 1/11] FROM docker.io/library/ubuntu:18.04 0.0s
=> [ 2/11] RUN apt clean && apt autoclean && apt-get update && apt-get install -y build-essential gettext-base git jq openjdk-8-jdk curl 411.0s
=> [ 3/11] RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - 42.6s
=> [ 4/11] RUN apt-get install -y nodejs 16.7s
=> [ 5/11] RUN npm install -g yarn 1.3s
=> [ 6/11] RUN cd /usr/local/bin && curl https://s3-us-west-1.amazonaws.com/cf-cli-releases/releases/v6.47.2/cf-cli_6.47.2_linux_x86-64.tgz | tar zxvf - 2.9s
=> [ 7/11] RUN mkdir /theia-app 0.5s
=> [ 8/11] ADD package.json /theia-app 0.0s
=> [ 9/11] WORKDIR /theia-app 0.0s
=> [10/11] RUN yarn --cache-folder ./ycache && rm -rf ./ycache && NODE_OPTIONS="--max_old_space_size=8192" yarn theia build ; yarn theia download:plugins 167.6s
=> [11/11] ADD plugins/*.vsix /theia-app/plugins/ 0.4s
=> exporting to image 9.3s
=> => exporting layers 9.3s
=> => writing image sha256:90593c01546697b3084c720dc30307e534231a9555946b0f491eaeb33fc55649 0.0s
=> => naming to docker.io/library/my-theia-sts 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
ついに、ドッカーイメージが出来た!!✌
![](https://assets.st-note.com/img/1660894860850-ifC0j91A8Y.png?width=1200)
だけどー-、コマンドプロンプトで動かねーー
![](https://assets.st-note.com/img/1660895012531-bT3en1Y9y2.png?width=1200)
WSL2だと、動いたけどエラーーー。。。なんでやねん!
$ docker run -it --init -p 3000:3000 -p 8080:8080 -v "$(pwd):/home/project:cached" my-theia-sts
yarn run v1.22.19
$ /theia-app/node_modules/.bin/theia start --hostname=0.0.0.0 /home/project
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module '/theia-app/src-gen/backend/main.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Done in 0.52s.