やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

asciinemaで端末の入出力をGIFアニメにしたいができなかった

 Node.jsの環境構築でつまづいた。

手順

1. パッケージ確認

apt search asciinema
apt search asciicast2gif
apt search nodejs
ツール 動作環境
asciinema python3
asciicast2gif nodejs

asciinema

sudo apt -y install asciinema

Node.js

sudo apt install -y nodejs
$ nodejs --version
v10.15.2

npm

 なぜかnpmもなかったので別途インストール。

sudo apt -y install npm
sudo npm install npm@latest -g

asciicast2gif

sudo npm install --global asciicast2gif
npm install -g phantomjs@version
npm WARN npm npm does not support Node.js v10.15.2
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! code ETARGET
npm ERR! notarget No matching version found for phantomjs@2.1.16
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2019-12-23T05_55_41_079Z-debug.log

/home/pi/.npm/_logs/2019-12-23T05_55_41_079Z-debug.log

0 info it worked if it ends with ok
1 warn npm npm does not support Node.js v10.15.2
2 warn npm You should probably upgrade to a newer version of node as we
3 warn npm can't make any promises that npm will work with this version.
4 warn npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
5 warn npm You can find the latest version at https://nodejs.org/
6 verbose cli [ '/usr/bin/node',
6 verbose cli   '/usr/bin/npm',
6 verbose cli   'install',
6 verbose cli   '-g',
6 verbose cli   'phantomjs@version' ]
7 info using npm@5.8.0
8 info using node@v10.15.2
9 verbose npm-session a57865f9fc094558
10 silly install loadCurrentTree
11 silly install readGlobalPackageData
12 http fetch GET 200 https://registry.npmjs.org/phantomjs 416ms
13 silly registry:manifest no matching version for phantomjs@version in the cache. Forcing revalidation
14 http fetch GET 304 https://registry.npmjs.org/phantomjs 122ms (from cache)
15 silly fetchPackageMetaData error for phantomjs@version No matching version found for phantomjs@version
16 verbose type tag
17 verbose stack phantomjs: No matching version found for phantomjs@version
17 verbose stack     at pickManifest (/usr/share/npm/node_modules/pacote/node_modules/npm-pick-manifest/index.js:65:11)
17 verbose stack     at fetchPackument.then.packument (/usr/share/npm/node_modules/pacote/lib/fetchers/registry/manifest.js:52:18)
17 verbose stack     at tryCatcher (/usr/lib/nodejs/bluebird/js/release/util.js:16:23)
17 verbose stack     at Promise._settlePromiseFromHandler (/usr/lib/nodejs/bluebird/js/release/promise.js:512:31)
17 verbose stack     at Promise._settlePromise (/usr/lib/nodejs/bluebird/js/release/promise.js:569:18)
17 verbose stack     at Promise._settlePromise0 (/usr/lib/nodejs/bluebird/js/release/promise.js:614:10)
17 verbose stack     at Promise._settlePromises (/usr/lib/nodejs/bluebird/js/release/promise.js:693:18)
17 verbose stack     at Async._drainQueue (/usr/lib/nodejs/bluebird/js/release/async.js:133:16)
17 verbose stack     at Async._drainQueues (/usr/lib/nodejs/bluebird/js/release/async.js:143:10)
17 verbose stack     at Immediate.Async.drainQueues [as _onImmediate] (/usr/lib/nodejs/bluebird/js/release/async.js:17:14)
17 verbose stack     at runCallback (timers.js:705:18)
17 verbose stack     at tryOnImmediate (timers.js:676:5)
17 verbose stack     at processImmediate (timers.js:658:5)
18 verbose cwd /tmp/work
19 verbose Linux 4.19.75-v7l+
20 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "phantomjs@version"
21 verbose node v10.15.2
22 verbose npm  v5.8.0
23 error code ETARGET
24 error notarget No matching version found for phantomjs@version
25 error notarget In most cases you or one of your dependencies are requesting
25 error notarget a package version that doesn't exist.
26 verbose exit [ 1, true ]

 Node.jsのバージョンが古すぎるのが悪いのでは? でもaptではこれしかインストールできないし。

所感

 Node.jsはPython以上に環境構築がクソだったことを思い出した。泥沼にハマる前にやめよう。

対象環境

$ uname -a
Linux raspberrypi 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux