😽
WSL 環境での Re:VIEW の quick fix (2022/01 時点)
Re:VIEW を Docker で利用するとどうも動かない
sudo ./build-in-docker.sh
とするとなんかいろいろ吐いてうまくいかない。
Re:VIEW build error
$ sudo ./build-in-docker.sh
+ rm -rf node_modules
+ npm install --unsafe-perm
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated source-map-resolve@0.5.2: See https://github.com/lydell/source-map-resolve#deprecated
> review-template@0.0.2 postinstall
> bundle install
`/root` is not writable.
Bundler will use `/tmp/bundler20230123-21-lwik5t21' as your home directory temporarily.
Fetching gem metadata from https://rubygems.org/....
Resolving dependencies...
Using rake 13.0.6
Using tty-color 0.6.0
Fetching rouge 4.0.1
Using rubyzip 2.3.2
Using bundler 2.3.26
Fetching rexml 3.2.5
Using unicode-eaw 2.2.0
Using pastel 0.8.0
Using image_size 3.2.0
Using pandoc2review 1.4.0
Using tty-logger 0.6.0
Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/2.7.0/cache/rexml-3.2.5.gem`. It is likely that you need to grant write permissions for that path.
Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/2.7.0/cache/rexml-3.2.5.gem`. It is likely that you need to grant write permissions for that path.
Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/2.7.0/cache/rouge-4.0.1.gem`. It is likely that you need to grant write permissions for that path.
Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/2.7.0/cache/rexml-3.2.5.gem`. It is likely that you need to grant write permissions for that path.
Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/2.7.0/cache/rouge-4.0.1.gem`. It is likely that you need to grant write permissions for that path.
Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::PermissionError There was an error while trying to write to `/var/lib/gems/2.7.0/cache/rouge-4.0.1.gem`. It is likely that you need to grant write permissions for that path.
Bundler::PermissionError: There was an error while trying to write to `/var/lib/gems/2.7.0/cache/rexml-3.2.5.gem`. It islikely that you need to grant write permissions for that path.
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/shared_helpers.rb:105:in `rescue in filesystem_access'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/shared_helpers.rb:102:in `filesystem_access'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/rubygems_integration.rb:483:in `block in download_gem'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/retry.rb:40:in `run'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/retry.rb:30:in `attempt'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/rubygems_integration.rb:474:in `download_gem'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/source/rubygems.rb:539:in `download_gem'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/source/rubygems.rb:488:in `fetch_gem'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/source/rubygems.rb:465:in `fetch_gem_if_possible'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/source/rubygems.rb:158:in `install'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/installer/gem_installer.rb:54:in `install'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/installer/parallel_installer.rb:186:in `do_install'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/worker.rb:62:in `apply_func'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/worker.rb:57:in `block in process_queue'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/worker.rb:54:in `loop'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/worker.rb:54:in `process_queue'
/var/lib/gems/2.7.0/gems/bundler-2.3.26/lib/bundler/worker.rb:91:in `block (2 levels) in create_threads'
An error occurred while installing rexml (3.2.5), and Bundler cannot continue.
In Gemfile:
review was resolved to 5.5.0, which depends on
rexml
npm notice
npm notice New major version of npm available! 8.19.2 -> 9.3.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.3.1
npm notice Run npm install -g npm@9.3.1 to update!
npm notice
npm ERR! code 5
npm ERR! path /book
npm ERR! command failed
npm ERR! command sh -c -- bundle install
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-01-23T12_45_23_608Z-debug-0.log
とりあえずの quick fix
build-in-docker.sh
の中では docker run -t --rm -v $(pwd):/book vvakame/review:5.5 /bin/bash -ci "cd /book && ./setup.sh && REVIEW_CONFIG_FILE=$REVIEW_CONFIG_FILE npm run pdf"
としているので、足りない gem を pwd
におけばとりあえず docker の中に持ち込めそう。
とりあえず rexml-3.2.5.gem
と rouge-4.0.1.gem
を持ってくる。
curl -OL https://rubygems.org/gems/rexml-3.2.5.gem
curl -OL https://rubygems.org/gems/rouge-4.0.1.gem
で、これらの gem を install するよう setup.sh
を変更する。
たぶん pwd に該当の gem があればそれを優先的に使って install してくれるっぽい。
$ git diff
diff --git a/setup.sh b/setup.sh
index 60bedc7..da31673 100755
--- a/setup.sh
+++ b/setup.sh
@@ -3,5 +3,9 @@
set -eux
rm -rf node_modules
+
+gem install rexml
+gem install rouge
+
# --unsafe-perm はrootでの実行時(= docker環境)で必要 非root時の挙動に影響なし
npm install --unsafe-perm
で、そうするとうまく動くっぽい。
Re:VIEW build success
$ sudo ./build-in-docker.sh
+ rm -rf node_modules
+ gem install rexml
Successfully installed rexml-3.2.5
Parsing documentation for rexml-3.2.5
Installing ri documentation for rexml-3.2.5
Done installing documentation for rexml after 0 seconds
1 gem installed
+ gem install rouge
Successfully installed rouge-4.0.1
Parsing documentation for rouge-4.0.1
Installing ri documentation for rouge-4.0.1
Done installing documentation for rouge after 2 seconds
1 gem installed
+ npm install --unsafe-perm
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated source-map-resolve@0.5.2: See https://github.com/lydell/source-map-resolve#deprecated
> review-template@0.0.2 postinstall
> bundle install
`/root` is not writable.
Bundler will use `/tmp/bundler20230123-39-4aqbyr39' as your home directory temporarily.
Fetching gem metadata from https://rubygems.org/....
Resolving dependencies...
Using rake 13.0.6
Using bundler 2.3.26
Using tty-color 0.6.0
Using rexml 3.2.5
Using rouge 4.0.1
Using image_size 3.2.0
Using pastel 0.8.0
Using unicode-eaw 2.2.0
Using tty-logger 0.6.0
Using rubyzip 2.3.2
Using pandoc2review 1.4.0
Using review 5.5.0
Bundle complete! 3 Gemfile dependencies, 12 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
added 246 packages, and audited 247 packages in 4m
8 packages are looking for funding
run `npm fund` for details
1 low severity vulnerability
To address all issues, run:
npm audit fix
Run `npm audit` for details.
npm notice
npm notice New major version of npm available! 8.19.2 -> 9.3.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.3.1
npm notice Run npm install -g npm@9.3.1 to update!
npm notice
> review-template@0.0.2 pdf
> grunt pdf
Running "clean:review" (clean) task
>> 0 paths cleaned.
Running "shell:preprocess" (shell) task
Running "shell:compile2pdf" (shell) task
review-pdfmaker config.yml
ℹ INFO compiling preface.tex
ℹ INFO compiling article.tex
ℹ INFO compiling contributors.tex
ℹ INFO uplatex -interaction=nonstopmode -file-line-error -halt-on-error __REVIEW_BOOK__.tex
ℹ INFO uplatex -interaction=nonstopmode -file-line-error -halt-on-error __REVIEW_BOOK__.tex
ℹ INFO uplatex -interaction=nonstopmode -file-line-error -halt-on-error __REVIEW_BOOK__.tex
ℹ INFO dvipdfmx -d 5 -z 9 __REVIEW_BOOK__.dvi
✔ SUCCESS built AzureMixBook2.pdf
Done.
実際は Ruby (rbenv で) を install してうんぬんなんだろうけど、それを回避するための Docker なので簡単に済ませたかったすみません。
Discussion