Visual Studio Code - インストール - FreeBSD - ports

クラウディア 
1. 概要
2. インストール
3. offline じゃだめ

1. 概要

 2021年12月7日に、リリースされた、「FreeBSD 12.3 RELEASE」へ「Visual Studio Code」をインストールしようとしたときに、えらいことになったのです。  まず、「pkg」に存在しないのです。  「ports」を見たら、かろうじて存在しておるので、「ports」でインストールしようとしたら、大変であったのですな。

2. インストール

 「ports」の環境を整える方法は、「FreeBSD 12.3 RELEASE」であれば、下記のあたりをご参照ください。
FreeBSD 12.3 RELEASE - ports・pkg」
「デスクトップ環境構築 - 共通事項 - システムインストール - FreeBSD 12.3 RELEASE
 「ports」の環境が整ったら

cd /usr/ports/editors/vscode
make
 で、インストールするのですが(オプションはないので、そのまま進みます)。  まぁ、長くかかりますわよ。  数時間では終わりません。数日かかることを覚悟しておいた方がよいかと思います。

3. offline じゃだめ

 前項で「make」し始めると、1日では終わらない気の遠くなるような時間をかけたあげく・・・。

yarn install v1.22.17
$ node build/npm/preinstall.js
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > css-loader@3.2.0" has incorrect peer dependency "webpack@^4.0.0".
warning " > eslint-plugin-header@3.1.1" has incorrect peer dependency "eslint@>=7.7.0".
warning " > file-loader@4.2.0" has incorrect peer dependency "webpack@^4.0.0".
warning " > gulp-postcss@9.0.0" has unmet peer dependency "postcss@^8.0.0".
warning " > gulp-tsb@4.0.6" has incorrect peer dependency "typescript@^3.0.0".
warning " > sinon-test@3.1.0" has incorrect peer dependency "sinon@2.x - 10.x".
warning " > style-loader@1.0.0" has incorrect peer dependency "webpack@^4.0.0".
[4/4] Building fresh packages...
$ node build/npm/postinstall.js
Installing dependencies in build...
$ yarn --frozen-lockfile --offline
yarn install v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
error Can't make a request in offline mode ("https://registry.yarnpkg.com/priorityqueuejs/-/priorityqueuejs-1.0.0.tgz")
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
*** Error code 1

Stop.
make: stopped in /usr/ports/editors/vscode
 とまぁ、こけちゃうのだ。  これ、分析すると、「--offline」ではうまくいかないのです。  なので、「Makefile」を編集します。

vi /usr/ports/editors/vscode/Makefile

pre-build:
        # # install node_modules without executing post-installation scripts
        # cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
        #       yarn --frozen-lockfile --ignore-scripts --offline
        # # copy rg binary files to vscode-ripgrep module directory
        # ${MKDIR} ${WRKSRC}/node_modules/vscode-ripgrep/bin
        # ${CP} ${LOCALBASE}/bin/rg ${WRKSRC}/node_modules/vscode-ripgrep/bin
        # ${MKDIR} ${WRKSRC}/remote/node_modules/vscode-ripgrep/bin
        # ${CP} ${LOCALBASE}/bin/rg ${WRKSRC}/remote/node_modules/vscode-ripgrep/bin
        # install node_modules
        cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
                yarn --frozen-lockfile --offline
        # copy rg binary files to vscode-ripgrep module directory
        ${MKDIR} ${WRKSRC}/node_modules/vscode-ripgrep/bin
        ${CP} ${LOCALBASE}/bin/rg ${WRKSRC}/node_modules/vscode-ripgrep/bin
        ${MKDIR} ${WRKSRC}/remote/node_modules/vscode-ripgrep/bin
        ${CP} ${LOCALBASE}/bin/rg ${WRKSRC}/remote/node_modules/vscode-ripgrep/bin
 189行目を下記のように変更します。

                yarn --frozen-lockfile
 再度

cd /usr/ports/editors/vscode
make
make install
 これを書きはじめたときは、バージョンが「1.63.1」でした。  バージョン「1.63.1」だと、「swap」メモリサイズが足りないとかで、「make」が落ちたりしまして。  「swap」を足しても、メモリ自体を増やしてもだめで。  バージョン「1.63.2」を開発中のリポジトリからとってきて「make」するということを行っていたのですが・・・。  書き進めているうちに、バージョン「1.63.2」がリリースされたようで、「Makefile」の書き換えのみで、なんとかインストールまでたどり着けました。  まぁ、何しろ早く、「pkg」が復活してほしいものです。
earthcar(アースカー)