【Yarn】「Unexpected end of JSON input」エラーの解決方法

【Yarn】「Unexpected end of JSON input」エラーの解決方法

angularリポジトリのangular.io(/aio)をローカルでセットアップしようとしたら、yarnコマンドで次のようなエラーが出てハマってしまいました。

$ yarn
yarn install v1.3.2
$ node ../tools/yarn/check-yarn.js
[1/5]   Validating package.json...
[2/5]   Resolving packages...
[3/5]   Fetching packages...
error An unexpected error occurred: "/Users/yuhiisk/Library/Caches/Yarn/v1/npm-tslib-1.8.0-dc604ebad64bcbf696d613da6c954aa0e7ea1eb6/.yarn-metadata.json: Unexpected end of JSON input".
info If you think this is a bug, please open a bug report with the information provided in "/Users/yuhiisk/****/angular/aio/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

最終的に次のコマンドを実行することで解決できました。

$ yarn cache clean

yarnのキャッシュが関係していた模様です。

五十川 洋平(Yohei Isokawa)

五十川 洋平(Yohei Isokawa)

フロントエンドエンジニア/面白法人カヤックなどのWeb制作会社に勤務したのち、故郷の新潟に戻り独立。JSフレームワークAngularやFirebase、Google Cloud Platformを使ったWebアプリ開発が得意。 また、Udemyのプログラミング解説の講師、writer.appの自主開発や上越TechMeetupの主催などを行っています。

プロフィール

©Copyright 2022 Yohei Isokawa All Rights Reserved.