我已经多次遇到此问题,并且可以通过运行bundle update
来解决此问题,但是现在我根本无法正常工作。大约三周以来我都没有碰过我的rails应用程序,现在我又回来了并且遇到了这个问题。
这是我得到的错误:
[root:acd9066b01f9:~/inspinia]# bundle update json 7:10PM/04.22
Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.7.0
Fetching json 1.8.6 (was 1.8.3)
Installing json 1.8.6 (was 1.8.3) with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/usr/local/rvm/gems/ruby-2.5.1/gems/json-1.8.6/ext/json/ext/generator
/usr/local/rvm/rubies/ruby-2.5.1/bin/ruby -r ./siteconf20190422-4608-t99jp9.rb
extconf.rb
Cannot allocate memory - /usr/local/rvm/rubies/ruby-2.5.1/bin/ruby -r
./siteconf20190422-4608-t99jp9.rb extconf.rb 2>&1
Gem files will remain installed in
/usr/local/rvm/gems/ruby-2.5.1/gems/json-1.8.6 for inspection.
Results logged to
/usr/local/rvm/gems/ruby-2.5.1/extensions/x86_64-linux/2.5.0/json-1.8.6/gem_make.out
An error occurred while installing json (1.8.6), and Bundler cannot
continue.
Make sure that `gem install json -v '1.8.6' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
rails was resolved to 4.2.3, which depends on
actionmailer was resolved to 4.2.3, which depends on
actionpack was resolved to 4.2.3, which depends on
actionview was resolved to 4.2.3, which depends on
rails-dom-testing was resolved to 1.0.7, which depends on
rails-deprecated_sanitizer was resolved to 1.0.3, which depends on
activesupport was resolved to 4.2.3, which depends on
json
因此,如上所示,我无法运行bundle update
。我曾尝试将其他版本的Json添加到Gemfile中,但是1.8.0、1.8.1都给了我相同的确切错误。
我也尝试安装其他版本的捆绑器:
[root:acd9066b01f9:~/inspinia]# gem install bundler -v '= 1.5.1' 7:10PM/04.22
Successfully installed bundler-1.5.1
Parsing documentation for bundler-1.5.1
Done installing documentation for bundler after 0 seconds
1 gem installed
没有帮助,因为我遇到了完全相同的问题。
我还尝试了其他帖子中提到的其他建议,包括libgmp-dev
:
[root:acd9066b01f9:~/inspinia]# apt-get install libgmp-dev 7:12PM/04.22
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgmp-dev is already the newest version (2:6.1.2+dfsg-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
任何想法都将不胜感激。这似乎是一个重复性的问题,无论出于何种原因我都无法摆脱。
答案 0 :(得分:0)
我多次遇到这个问题。
对于ubuntu环境,请尝试安装public static void addFoodsToListfast(ArrayList<Food> n) {
Food cereal = new Food("1 serving-All-bran cereal", Food.meal.BREAKFAST, 125);
n.add(cereal);
//and so on
}
libgmp3-dev
然后再次运行sudo apt-get install libgmp3-dev
。