1
1

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.

yarn install時にnode-9.4.2.tgz取得が404 Not Foundで失敗した

Posted at

ちょっと古いプロジェクトをcloneしてyarn installしたらエラーが発生した

実行ログ

$ yarn install
yarn install v1.15.2
[1/4] :mag:  Resolving packages...
[2/4] :truck:  Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@types/node/-/node-9.4.2.tgz: Request failed \"404 Not Found\"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/watanabe-yohei/work/repos/user/dojin.user/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

node-9.4.2.tgzが404 Not Foundとのこと

一応yarn-error.logも確認

Trace抜粋

Trace:
 Error: https://registry.yarnpkg.com/@types/node/-/node-9.4.2.tgz: Request failed "404 Not Found"
     at ResponseError.ExtendableBuiltin (/usr/local/Cellar/yarn/1.15.2/libexec/lib/cli.js:696:66)
     at new ResponseError (/usr/local/Cellar/yarn/1.15.2/libexec/lib/cli.js:802:124)
     at Request.<anonymous> (/usr/local/Cellar/yarn/1.15.2/libexec/lib/cli.js:66128:16)
     at Request.emit (events.js:197:13)
     at Request.module.exports.Request.onRequestResponse (/usr/local/Cellar/yarn/1.15.2/libexec/lib/cli.js:130418:10)
     at ClientRequest.emit (events.js:202:15)
     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:560:21)
     at HTTPParser.parserOnHeadersComplete (_http_common.js:113:17)
     at TLSSocket.socketOnData (_http_client.js:447:20)
     at TLSSocket.emit (events.js:197:13)

やっぱりnode-9.4.2.tgzが404 Not Foundとのこと

アクセスしてみてもNot Found

{"error":"Not found"}

node-9.4.2.tgzは死んだ。

yarn.lockが原因

前提としてyarn installについてざっくり説明

yarn installコマンドはpackage.lockに書かれているモジュールの常に最新を取ってくるが、 yarn.lock がある場合、yarn.lockに記載されたバージョンを取得する。
これによりバージョンの差異で挙動が違うなどの発生を低減できる、が、今回のような「期待するパッケージが失せてyarn install失敗」みたいなことが起こる。更新のプルリクを投げよう。

今回のyarn.lock

抜粋

"@types/node@*":
 version "9.4.2"
 resolved "https://registry.yarnpkg.com/@types/node/-/node-9.4.2.tgz#b109a6c4f64147ccf9476d39e1a6bfds9aa0faeb8"

対応

yarn.lockを削除して、yarn install

もしnode_modulesがあれば、それも消しておいた方がyarn installの邪魔をしない(気休め)

$ rm yarn.lock
$ rm -rf node_modules
$ yarn install
~略~
success Saved lockfile.
:sparkles:  Done in 29.33s.

successになればOK

参考

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?