8
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

nodenvのinstall -l で表示されるnodeバージョンリストを最新にする。

Last updated at Posted at 2020-03-12

東京都 新型コロナウイルス感染症対策サイト / Tokyo COVID-19 Task Force website
tokyo-metropolitan-gov/covid19

東京都 新型コロナウイルス感染症対策サイトのソースをforkし、ローカルで環境を構築中にnodeバージョンを入れるように警告がでましたがnodenvのinstall -lを実施したところ該当のバージョンがなく、nodeバージョンリストを最新にするためにやったことを記載しております。

$ yarn install
nodenv: version `10.19.0' is not installed (set by /{**}/covid19/.node-version)
$ cat covid19/.node-version
10.19.0

そこで$ nodenv install -lを実行したところ該当のnodeバージョンがありません。。 1

[node バージョンリスト表示]
$ nodenv install -l
...
10.15.3
10.16.0
10.16.1
10.16.2
10.16.3
10.17.0
...

私のnodenvはanyenv経由で構築しているのではじめはanyenvでなんとかしないといけないかなと思いましたが
どうやらnodenvのリストを自分で更新する必要があるようです。

github.com/nodenv/node-build#upgrading

[公式のドキュメントによると以下を実行するように記載されています。]
$ git -C "$(nodenv root)"/plugins/node-build pull

これを自分の環境に置き換えて対応します。

[① nodenvがどこにあるのか確認]
$ which nodenv
YOUR/INSTALL/PATH/.anyenv/envs/nodenv/bin/nodenv
[② anyenv配下のnodenvへ移動]
$ cd YOUR/INSTALL/PATH/.anyenv/envs/nodenv
[③ git pullを実行 公式にある指示]
$ git pull
remote: Enumerating objects: 839, done.
remote: Counting objects: 100% (839/839), done.
remote: Compressing objects: 100% (168/168), done.
remote: Total 934 (delta 646), reused 792 (delta 622), pack-reused 95
Receiving objects: 100% (934/934), 182.67 KiB | 422.00 KiB/s, done.
Resolving deltas: 100% (658/658), completed with 301 local objects.
From https://github.com/nodenv/node-build
   3df19246..cdb2593c  master               -> origin/master
 * [new branch]        scrape-workflow      -> origin/scrape-workflow
 * [new tag]           ruby-build/v20191024 -> ruby-build/v20191024
 * [new tag]           ruby-build/v20191030 -> ruby-build/v20191030
...
 rename test/helpers/warning_messages => script/lint/lts (84%)
 create mode 100644 share/node-build/10.18.0
 create mode 100644 share/node-build/10.18.1
 create mode 100644 share/node-build/10.19.0 [→ 今回ほしい該当のバージョン]
 create mode 100644 share/node-build/12.14.0

git pullを実行するとログからnodeで追加されたバージョンを確認することができます。
改めて $ nodenv install -lを実行します。

[node バージョンリスト表示]
$ nodenv install -l
...
10.16.1
10.16.2
10.16.3
10.17.0
10.18.0
10.18.1
10.19.0 [→ 今回ほしい該当のバージョン]
11.10.0
...

ほしいバージョンが表示されています。

蛇足

一応ローカルでサイトが立ち上がることを確認します。

$ nodenv install 10.19.0
Downloading node-v10.19.0-darwin-x64.tar.gz...
-> https://nodejs.org/dist/v10.19.0/node-v10.19.0-darwin-x64.tar.gz
Installing node-v10.19.0-darwin-x64...
Installed node-v10.19.0-darwin-x64 to YOUR/INSTALL/PATH/.anyenv/envs/nodenv/versions/10.19.0
$ yarn install
yarn install v1.22.4
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
warning "babel-jest > babel-preset-jest > @babel/plugin-syntax-object-rest-spread@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "vue-jest > @babel/plugin-transform-modules-commonjs@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
・・・
✨  Done in 12.70s.

無事に$yarn installに成功しました。
そして、都内の最新感染動向 | 東京都 新型コロナウイルス感染症対策サイトを起動することができました。

  1. それぞれの環境で表示されるバージョンは異なると思います。

8
11
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
8
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?