我正在尝试在离线环境中运行新的 Rails 7 应用程序项目。我已经配置了 npm、yarn、nvm 和 gem artifactory 远程存储库。我已在 .gemrc 文件中指定指向工件存储库的源值。传统的 gem 安装效果很好:
gem install aaron-test-gem
Fetching aaron-test-gem-0.0.0.gem
Successfully installed aaron-test-gem-0.0.0
Parsing documentation for aaron-test-gem-0.0.0
Installing ri documentation for aaron-test-gem-0.0.0
Done installing documentation for aaron-test-gem after 0 seconds
1 gem installed
但是当我尝试使用命令运行新的 Rails 应用程序时:
rails new projapp -d postgresql -j esbuild --css bootstrap
我收到错误:
remove config/initializers/new_framework_defaults_7_1.rb
run bundle install
Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/specs.4.8.gz)>
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/specs.4.8.gz)>
Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/specs.4.8.gz)>
Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/specs.4.8.gz)>
run bundle lock --add-platform=x86_64-linux
Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/specs.4.8.gz)>
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/specs.4.8.gz)>
Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/specs.4.8.gz)>
Could not fetch specs from https://rubygems.org/ due to underlying error <Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/specs.4.8.gz)>
run bundle binstubs bundler
Could not find gem 'sprockets-rails' in locally installed gems.
rails javascript:install:esbuild
Could not find gem 'sprockets-rails' in locally installed gems.
Run `bundle install` to install missing gems.
rails turbo:install stimulus:install
Could not find gem 'sprockets-rails' in locally installed gems.
Run `bundle install` to install missing gems.
rails css:install:bootstrap
Could not find gem 'sprockets-rails' in locally installed gems.
Run `bundle install` to install missing gems.
有什么方法可以运行新的 Rails 项目并为其指定 gem 源吗?
是的,可以选择使用内部 gem 存储库创建新项目:
捆绑配置集--全局镜像。https://rubygems.org https://mycompany/artifactory/api/gems/gems-remote