LoginSignup
0

More than 5 years have passed since last update.

nvm の checksums do not match エラーの回避

Last updated at Posted at 2017-03-17

はじめに

Node.jsのバージョン管理をしてくれる nvmを使ってみたとき覚え書きです。
(CentOS 6.8で確認)
nvm - Node Version Manager

問題

nvm install 実行時に以下のエラーが表示されて、インストールが失敗する

[root@localhost ~]# nvm install 6
Downloading and installing node v6.10.0...
-- 省略 --
################################################################ 100.0%
Computing checksum with sha256sum
Checksums do not match: 'de12****' found, 'f65d****' expected.
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now
nvm: install v6.10.0 failed!

原因

調べたところ、 チェックサム関数 shasum というコマンドが重要みたい

CentOSでは 、sha1sum や sha256sum コマンドがあるが、
shasum コマンドはデフォルトで使えないことが原因(だと思います)

対処

shasumのエイリアスを作って、(一時的に)使えるようにする必要がある

alias shasum=sha256sum

alias作成を含めた実行内容

[root@localhost ~]# alias shasum=sha256sum
[root@localhost ~]# nvm install 6
Downloading and installing node v6.10.0...
-- 省略 --
Computing checksum with sha256sum
Checksums do not match: '4e70****' found, '0f28****' expected.
Checksum check failed!
Removing the broken local cache...
Downloading https://nodejs.org/dist/v6.10.0/node-v6.10.0-linux-x64.tar.xz...
################################################################ 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v6.10.0 (npm v3.10.10)
Creating default alias: default -> 6 (-> v6.10.0)

(なんか1回コケてるけど)できた!

謝辞

こちらを参考にさせていただきました。
nvmでnodeをインストールするとエラーになる
上記ブログの alias shasum=sha1sum を試してみたけど、結果は失敗。
alias shasum=sha256sum でエイリアスを作ったらうまくいった。
nvmの中身がなにか変更されたのかな

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
0