4
3

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 1 year has passed since last update.

yarn install でIntegrity check failedが起きたらupdate-checksumsすると直る

Posted at

起きたこと

vue を入れ直してyarn installしたところ nanoidの依存関係で失敗してた。

yarn install v1.22.17
warning package.json: No license field
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
warning sampleapps@1.2.0: No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error https://registry.npmjs.org/nanoid/-/nanoid-3.1.31.tgz: Integrity check failed for "nanoid" (computed integrity doesn't match our records, got "sha512-ZivnJm0o9bb13p2Ot5CpgC2rQdzB9Uxm/mFZweqm5eMViqOJe3PV6LU2E30SiLgheesmcPrjquqraoolONSA0A== sha1-9bWKHOG3YE2l8GBXV4QFmNiXTcY=")
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

解消方法

ソースに他人のlockファイルが入っている場合はハッシュを更新することで解消する。

$ yarn --update-checksums

原因

原因はGitのコードにpackage-lock.jsonとyarn.lockの情報がコミットされていて別の人のデータをクローンしてきてことでハッシュが違うと怒られてる見たい。

ちなみにIntegrityは作成したソースコードに対してハッシュ関数をぶつけて所有者以外が勝手に改ざんしてないかを調べる

※ にわかなのでセキュリティ詳しい人はコメント欲しいです。

4
3
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
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?