我收到了一個使用Ruby on Rails構建的網站。我認爲該網站大約在3年前建成。我試圖在本地計算機上運行它,但在嘗試運行服務器時出現一些錯誤。「安裝json(1.8.0)時發生錯誤,並且Bundler無法繼續」in Rails
版本:紅寶石2.4.0p0
的Rails 5.1.1
家釀1.2.3
Git版本2.11.0
當我運行rails s
我得到這個錯誤:
Could not find proper version of railties (3.2.6) in any of the sources
Run `bundle install` to install missing gems.
當我運行bundle install
時,我得到:
An error occurred while installing json (1.8.0), and Bundler cannot
continue.
Make sure that `gem install json -v '1.8.0'` succeeds before bundling.
我有谷歌的錯誤,並嘗試過各種事情,但仍然沒有運氣。 有人說加寶石「JSON」,「1.8.0」創業板文件,但仍然沒有運氣
這裏是Gemfile中
source 'https://rubygems.org'
gem 'rails', '3.2.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2', '> 0.3'
gem 'bluecloth'
gem 'simple_form'
gem 'carrierwave'
gem 'rmagick'
gem 'capistrano'
gem 'rvm-capistrano'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
這是因爲版本不兼容?
Gemfile.lock的
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.6)
actionpack (= 3.2.6)
mail (~> 2.4.4)
actionpack (3.2.6)
activemodel (= 3.2.6)
activesupport (= 3.2.6)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.3)
activemodel (3.2.6)
activesupport (= 3.2.6)
builder (~> 3.0.0)
activerecord (3.2.6)
activemodel (= 3.2.6)
activesupport (= 3.2.6)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.6)
activemodel (= 3.2.6)
activesupport (= 3.2.6)
activesupport (3.2.6)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
bluecloth (2.2.0)
builder (3.0.0)
capistrano (2.12.0)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
carrierwave (0.6.2)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.3.3)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
highline (1.6.12)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.4)
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.7.3)
libv8 (3.16.14.13)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.3.6)
mysql2 (0.3.11)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
net-ssh (>= 2.0.9)
net-ssh (2.5.2)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.2.6)
actionmailer (= 3.2.6)
actionpack (= 3.2.6)
activerecord (= 3.2.6)
activeresource (= 3.2.6)
activesupport (= 3.2.6)
bundler (~> 1.0)
railties (= 3.2.6)
railties (3.2.6)
actionpack (= 3.2.6)
activesupport (= 3.2.6)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
ref (2.0.0)
rmagick (2.13.1)
rvm-capistrano (1.4.1)
capistrano (>= 2.0.0)
sass (3.1.20)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
simple_form (2.0.1)
actionpack (~> 3.0)
activemodel (~> 3.0)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
thor (0.15.4)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
uglifier (1.2.6)
execjs (>= 0.3.0)
multi_json (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
bluecloth
capistrano
carrierwave
coffee-rails (~> 3.2.1)
jquery-rails
mysql2 (> 0.3)
rails (= 3.2.6)
rmagick
rvm-capistrano
sass-rails (~> 3.2.3)
simple_form
therubyracer
uglifier (>= 1.0.3)
當我運行gem install json -v '1.8.0'
我得到以下(這也是建議很多關於誰是具有相同的問題,因爲我的人,但並未奏效 - 甚至使用sudo) :
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
current directory: /Users/me/.rvm/gems/ruby-2.4.0/gems/json-1.8.0/ext/json/ext/generator
/Users/me/.rvm/rubies/ruby-2.4.0/bin/ruby -r ./siteconf20170622-61950-1tcycqj.rb extconf.rb
creating Makefile
current directory: /Users/me/.rvm/gems/ruby-2.4.0/gems/json-1.8.0/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /Users/me/.rvm/gems/ruby-2.4.0/gems/json-1.8.0/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:47: error: too few arguments provided to function-like macro invocation
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
/Users/me/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/intern.h:795:9: note: macro 'rb_str_new' defined here
#define rb_str_new(str, len) RB_GNUC_EXTENSION_BLOCK( \
^
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:11: warning: incompatible pointer to integer conversion initializing 'VALUE' (aka 'unsigned long') with an expression of type 'VALUE (const char *, long)' (aka 'unsigned long (const char *, long)') [-Wint-conversion]
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^ ~~~~~~~~~~
generator.c:840:25: error: use of undeclared identifier 'rb_cFixnum'
} else if (klass == rb_cFixnum) {
^
generator.c:842:25: error: use of undeclared identifier 'rb_cBignum'
} else if (klass == rb_cBignum) {
^
1 warning and 3 errors generated.
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/me/.rvm/gems/ruby-2.4.0/gems/json-1.8.0 for inspection.
Results logged to /Users/me/.rvm/gems/ruby-2.4.0/extensions/x86_64-darwin-16/2.4.0/json-1.8.0/gem_make.out
當您嘗試'gem install json -v'1.8.0''時會發生什麼?你可能需要用'sudo'運行它。 – mmichael
gem install json -v'1.8.0':返回一個錯誤,我用sudo運行它 – idm
你的'Gemfile.lock'看起來像什麼?這將向您顯示您現有的寶石的依賴關係,這可以揭示問題。 – octopushugs