每次我运行一些 rake 或捆绑器时,我都会遇到这个问题,但是新旧版本没有什么不同,而且总是相同的宝石,我什至之前已经提交了这些更改,但它仍然出现
$ git diff
diff --git a/Gemfile.lock b/Gemfile.lock
index d2dc051..90b25d4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -17,6 +17,13 @@ GIT
nested_form (0.3.2)
GIT
+ remote: git://github.com/stefanpenner/country_select.git
+ revision: 79755038ca61dafdfebf4c55346d4a2085f98479
+ specs:
+ country_select (2.1.0)
+ countries (~> 0.9, >= 0.9.3)
+
+GIT
remote: git://github.com/rubenrails/rails-bootstrap-forms.git
revision: 88b7ded3cdcca5af3070d6680f5e2b73303b277e
branch: no_form_group
@@ -34,13 +41,6 @@ GIT
rails (>= 3.1)
railties (>= 3.1)
-GIT
- remote: git://github.com/stefanpenner/country_select.git
- revision: 79755038ca61dafdfebf4c55346d4a2085f98479
- specs:
- country_select (2.1.0)
- countries (~> 0.9, >= 0.9.3)
- …Run Code Online (Sandbox Code Playgroud) 我有一个运行包裹打包器的简单 JS 文件:
const Bundler = require('parcel-bundler');
(async () => {
const bundler = new Bundler('./src/index.html', {}); // options omitted for simplicity
await bundler.bundle();
})();
Run Code Online (Sandbox Code Playgroud)
我从 CLI 运行它:
node ./build.js
Run Code Online (Sandbox Code Playgroud)
虽然 bundler 工作正常并在dist文件夹中创建捆绑文件,但该过程永远不会退出,而是保留在异步循环中。
我尝试添加then回调或使用返回,但没有任何帮助。使用process.exit()当然会停止这个过程,但也会限制我在 CI 中链接这个命令,这是整个目的。
我究竟做错了什么?
我正在尝试2.1在从ruby:2.4.1. 我的 Docker 文件如下所示:
FROM ruby:2.4.1
RUN \
gem update --system --quiet && \
gem install bundler -v '~> 2.1'
# Other commands
Run Code Online (Sandbox Code Playgroud)
但是当我尝试运行时bundle install它失败了
You must use Bundler 2 or greater with this lockfile.
Run Code Online (Sandbox Code Playgroud)
当我在容器内运行时,gem info bundler它输出:
bundler (2.1.2, 1.15.4)
Authors: André Arko, Samuel Giddins, Colby Swandale, Hiroshi
Shibata, David Rodríguez, Grey Baker, Stephanie Morillo, Chris
Morris, James Wen, Tim Moore, André Medeiros, Jessica Lynn Suttles,
Terence Lee, Carl Lerche, Yehuda …Run Code Online (Sandbox Code Playgroud) 我使用 PHP Slim4 框架编写了一个 REST-API 应用程序。但是,现在我想部署该应用程序。我似乎找不到像 webpack 这样直观的工具来将我的应用程序捆绑到几个文件中,并对任何未使用的代码进行树摇动。
人们是否有使用 PHP 进行部署的工具?我不习惯部署 PHP 应用程序,所以我不确定将 PHP 应用程序部署到野外的最佳实践是什么?
我正在尝试安装pg_search gem。在第一次尝试中,我没有注意 ruby 的必要版本(我们正在使用2.3.1并且2.4是必需的),在出现的错误消息中我被要求运行bundle update,但它更新了 pg_search 到2.3.5需要 ruby >= 2.5。即使我指定了旧版本的 gem,它仍然显示相同的消息:
Gem::InstallError: pg_search requires Ruby version >= 2.5.
An error occurred while installing pg_search (2.3.5), and Bundler cannot continue.
Make sure that `gem install pg_search -v '2.3.5'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
我已经通过运行安装了 gem docker-compose run web gem install pg_search -v 2.1.4,并重新创建了容器。我的 Gemfile:
Gem::InstallError: pg_search requires Ruby version >= 2.5.
An error occurred while installing pg_search (2.3.5), and Bundler cannot continue. …Run Code Online (Sandbox Code Playgroud) 红宝石3.1.0
Rails 7.0.2.2(包含捆绑和 Postgresql)
运行捆绑安装时,我在 puma 5.6.2 上不断遇到这种奇怪的崩溃。
% bundle install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using rake 13.0.6
Using racc 1.6.0
Using crass 1.0.6
Using minitest 5.15.0
Using builder 3.2.4
Using digest 3.1.0
Using rack 2.2.3
Using io-wait 0.2.1
Using concurrent-ruby 1.1.9
Using websocket-extensions 0.1.5
Using marcel 1.0.2
Using mini_mime 1.1.2
Using bundler 2.3.3
Using timeout 0.2.0
Using nio4r 2.5.8
Using strscan 3.0.1
Using bindex 0.8.1
Using public_suffix 4.0.6
Using thor 1.2.1
Using erubi 1.10.0
Using …Run Code Online (Sandbox Code Playgroud) 有多个类似的帐户,但这里发生了不同的事情。我在这里写过这个问题。
以下是背景信息:
$ which ruby
/Users/johnlarkin/.rvm/rubies/ruby-3.1.3/bin/ruby
$ ruby -v
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [arm64-darwin22]
$ which openssl
/opt/homebrew/opt/openssl@3/bin/openssl
$ openssl version
OpenSSL 3.1.0 14 Mar 2023 (Library: OpenSSL 3.1.0 14 Mar 2023)
Run Code Online (Sandbox Code Playgroud)
我可以eventmachine这样安装:
$ gem install eventmachine -v '1.2.7' -- --with-ssl-dir=/opt/homebrew/opt/openssl@3
Building native extensions with: '--with-ssl-dir=/opt/homebrew/opt/openssl@3'
This could take a while...
Successfully installed eventmachine-1.2.7
Parsing documentation for eventmachine-1.2.7
Done installing documentation for eventmachine after 0 seconds
1 gem installed
Run Code Online (Sandbox Code Playgroud)
但是,当我转到 时bundle install,它仍然不起作用:
^ …Run Code Online (Sandbox Code Playgroud) 我正在尝试安装Bundler,这样我就可以将我的Sinatra应用程序部署到具有所有正确宝石的服务器上.
我已经创建了我的Gemfile
source :gemcutter
gem 'sinatra', '1.0'
gem "nokogiri", "1.4.2"
gem "rack", "1.1.0"
gem "dm-core", "1.0.0"
gem "dm-migrations", "1.0.0"
gem "dm-sqlite-adapter", "1.0.0"
gem "pony", "1.0"
Run Code Online (Sandbox Code Playgroud)
接下来我创建了一个Config.ru
require 'rubygems'
require 'bundler'
Bundler.setup
require 'sinatra'
require 'dm-core'
require 'dm-migrations'
require 'dm-sqlite-adapter'
require 'open-uri'
require 'nokogiri'
require 'csv'
require 'pony'
require 'parsedate'
require 'digest/md5'
require 'MyApp'
run MyApp
Run Code Online (Sandbox Code Playgroud)
到目前为止一直很好,所以接下来我跑了bundle install并且得到了'Bundle Complete'所以现在我需要做的只是Rackup
然后我得到:
config.ru:18: undefined local variable or method `MyApp' for #<Rack::Builder:0x1227350 @ins=[]> (NameError)
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
from …Run Code Online (Sandbox Code Playgroud) 我正在开发一个gem,我的Gemfile看起来像这样:
source :rubygems
gemspec
group :development, :test do
gem "pry"
gem "debugger"
gem "rake"
end
Run Code Online (Sandbox Code Playgroud)
但是,我不希望人们必须安装pry和debugger运行测试,但我也希望能够在我的测试中要求它们(因为我正在运行带有前缀的测试bundle exec,我无法在我的加载路径中获取它们如果他们不在Gemfile中).我该如何实现这一目标?
另外,何时将用于开发的宝石放在gemspec中,何时将它们放入Gemfile中?我真的不知道区别.
我正在尝试部署,我不希望版本控制中的Gemfile.lock.但当它被删除时,我得到以下错误.
* executing "cd /var/www/vhosts/my-site/releases/20120628162217 && bundle install -- gemfile /var/www/vhosts/mysite/releases/20120628162217/Gemfile --path /var/www/vhosts/my-site/shared/bundle --deployment --quiet --without development test cucumber analytics"
servers: ["staging-beta.my-site.com"]
[staging-beta.my-sitehealth.com] executing command
** [out :: staging-beta.my-site.com] The --deployment flag requires a Gemfile.lock. Please make sure you have checked your Gemfile.lock into version control before deploying.
command finished in 332ms
Run Code Online (Sandbox Code Playgroud)
这是我的deploy.rb文件:
require 'thinking_sphinx/deploy/capistrano'
set :rvm_ruby_string, '1.9.3'
# Ignore the .git directory when creating a release
set :copy_exclude, ".git*"
set :stages, %w(production staging rails_ec2_west_staging vagrant analytics highgroove ec2_highgroove stage_analytics …Run Code Online (Sandbox Code Playgroud) bundler ×10
ruby ×7
rubygems ×3
node.js ×2
async-await ×1
capistrano ×1
docker ×1
eventmachine ×1
gem ×1
gemspecs ×1
javascript ×1
parceljs ×1
php ×1
puma ×1
rack ×1
sinatra ×1
slim ×1
testing ×1
webpack ×1