Yarn Registry 总是返回 503 Unavailable
Posted
技术标签:
【中文标题】Yarn Registry 总是返回 503 Unavailable【英文标题】:Yarn Registry always returns 503 Unavailable 【发布时间】:2018-11-16 08:30:37 【问题描述】:在过去的 2 天里,我在将 Rails+React 应用程序部署到 Heroku 时遇到了问题。这个问题是间歇性的(有时我可以部署),这让我认为这是 Heroku 连接到纱线注册表的问题。
当我转到注册表https://registry.yarnpkg.com 时,一切似乎都运行良好。当我转到 Heroku 的状态页面 (https://status.heroku.com/) 时,他们并没有说他们有任何问题。
这是我的代码库有问题吗?我应该设置一个纱镜吗?
以下是我的控制台日志。它总是在某些时候失败,但每次使用不同的包。
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.3.7
-----> Installing dependencies using bundler 1.15.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Using rake 12.3.1
Using concurrent-ruby 1.0.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using builder 3.2.3
Using erubi 1.7.1
Using mini_portile2 2.3.0
Using crass 1.0.4
Using rack 2.0.5
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using mini_mime 1.0.0
Using arel 8.0.0
Using execjs 2.7.0
Using aws-sigv4 1.0.2
Using jmespath 1.4.0
Using babel-source 5.8.35
Using bcrypt 3.1.12
Using popper_js 1.12.9
Using rb-fsevent 0.10.3
Using ffi 1.9.23
Using bundler 1.15.2
Using coffee-script-source 1.12.2
Using method_source 0.9.0
Using thor 0.20.0
Using connection_pool 2.2.1
Using orm_adapter 0.5.0
Using unf_ext 0.0.7.5
Using multipart-post 2.0.0
Using multi_json 1.13.1
Using mime-types-data 3.2016.0521
Using mini_magick 4.8.0
Using mustermann 1.0.2
Using netrc 0.11.0
Using pg 1.0.0
Using puma 3.11.4
Using tilt 2.0.8
Using turbolinks-source 5.1.0
Using tzinfo 1.2.5
Using nokogiri 1.8.2
Using websocket-driver 0.6.5
Using mail 2.7.0
Using i18n 1.0.1
Using autoprefixer-rails 8.5.0
Using uglifier 4.1.10
Using rack-test 1.0.0
Using warden 1.2.7
Using rack-protection 2.0.1
Using rack-proxy 0.6.4
Using sprockets 3.7.1
Using babel-transpiler 0.7.0
Using aws-sdk-core 2.11.58
Using rb-inotify 0.9.10
Using coffee-script 2.4.1
Using unf 0.1.4
Using faraday 0.15.2
Using mime-types 3.1
Using turbolinks 5.1.1
Using activesupport 5.1.6
Using loofah 2.2.2
Using sinatra 2.0.1
Using sass-listen 4.0.0
Using aws-sdk-resources 2.11.58
Using domain_name 0.5.20180417
Using sentry-raven 2.7.3
Using rails-dom-testing 2.0.3
Using globalid 0.4.1
Using activemodel 5.1.6
Using jbuilder 2.7.0
Using sass 3.5.6
Using rails-html-sanitizer 1.0.4
Using aws-sdk 2.11.58
Using http-cookie 1.0.3
Using activerecord 5.1.6
Using actionview 5.1.6
Using rest-client 2.0.2
Using activejob 5.1.6
Using friendly_id 5.1.0
Using actionpack 5.1.6
Using bootstrap 4.1.1
Using refile 0.6.2 from https://github.com/manfe/refile.git (at master@46b4178)
Using actioncable 5.1.6
Using actionmailer 5.1.6
Using railties 5.1.6
Using sprockets-rails 3.2.1
Using simple_form 4.0.1
Using refile-mini_magick 0.2.0
Using refile-s3 0.2.0
Using coffee-rails 4.2.2
Using responders 2.4.0
Using font-awesome-rails 4.7.0.4
Using jquery-rails 4.3.3
Using react-rails 2.4.4
Using webpacker 3.5.3
Using rails 5.1.6
Using sass-rails 5.0.7
Using devise 4.4.3
Bundle complete! 29 Gemfile dependencies, 97 gems now installed.
Gems in the groups development and test were not installed.
Bundled gems are installed into ./vendor/bundle.
Bundle completed (5.27s)
Cleaning up the bundler cache.
Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
The latest bundler is 1.16.2, but you are currently running 1.15.2.
To update, run `gem install bundler`
-----> Installing node-v8.10.0-linux-x64
-----> Installing yarn-v1.5.1
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
W, [2018-06-06T15:12:59.637954 #408] WARN -- sentry: ** [Raven] You are running on Heroku but haven't enabled Dyno Metadata. For Sentry's release detection to work correctly, please run `heroku labs:enable runtime-dyno-metadata`
yarn install v1.5.1
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz: Request failed \"503 Service Unavailable\"".
info If you think this is a bug, please open a bug report with the information provided in "/tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Webpacker is installed ???? ????
Using /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/config/webpacker.yml file for setting up webpack paths
Compiling…
Compilation failed:
/tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/vendor/bundle/ruby/2.3.0/gems/webpacker-3.5.3/lib/webpacker/webpack_runner.rb:11:in `exec': No such file or directory - /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/node_modules/.bin/webpack (Errno::ENOENT)
from /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/vendor/bundle/ruby/2.3.0/gems/webpacker-3.5.3/lib/webpacker/webpack_runner.rb:11:in `block in run'
from /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/vendor/bundle/ruby/2.3.0/gems/webpacker-3.5.3/lib/webpacker/webpack_runner.rb:10:in `chdir'
from /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/vendor/bundle/ruby/2.3.0/gems/webpacker-3.5.3/lib/webpacker/webpack_runner.rb:10:in `run'
from /tmp/build_fb670161fa41f98e3b1b96e827ab0a9e/vendor/bundle/ruby/2.3.0/gems/webpacker-3.5.3/lib/webpacker/runner.rb:6:in `run'
from ./bin/webpack:15:in `<main>'
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app.
! Push failed
```
【问题讨论】:
这里一样,昨天开始发生。 @pawurb 很高兴知道我没疯 :) 【参考方案1】:这可能与 npmjs.org 注册表未能响应某些请求并间歇性返回 503 有关。
似乎“Yarn 的后端只是 npm 之上的反向代理。它由 CloudFlare 提供支持”(引自:https://github.com/yarnpkg/yarn/issues/3804)。
Heroku 或 Yarn 都没有对此负责的可能性很高。我建议您查看https://status.npmjs.org/ 以了解有关您遇到的问题的潜在更新,尤其是刚刚打开的这张票:Intermittent 503's status returns。
【讨论】:
以上是关于Yarn Registry 总是返回 503 Unavailable的主要内容,如果未能解决你的问题,请参考以下文章