ubuntu 12.04上的json问题

时间:2021-04-22 06:36:22

I'm having problems when I try to rake db:migrate. I get the following error:

当我尝试使用db:migrate时,我遇到了问题。我收到以下错误:

Could not find json-1.7.5 in any of the sources  
Run `bundle install` to install missing gems.

Now, I've already run bundle install and it gave an error when it got to json, but I try it again anyway and get the same error when it gets to json:

现在,我已经运行了bundle install,当它到达json时它给出了一个错误,但是无论如何我再次尝试它并且当它到达json时得到相同的错误:

Installing json (1.7.5) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

使用本机扩展安装json(1.7.5)Gem :: Installer :: ExtensionBuildError:错误:无法构建gem本机扩展。

    /usr/bin/ruby1.9.1 extconf.rb  /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot

load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require' from extconf.rb:1:in'

加载这样的文件 - 来自/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in的'mkmf(LoadError)'需要'来自extconf.rb:1:in'

Gem files will remain installed in /home/chris/.bundler/tmp/2984/gems/json-1.7.5 for inspection. Results logged to /home/chris/.bundler/tmp/2984/gems/json-1.7.5/ext/json/ext/generator/gem_make.out An error occurred while installing json (1.7.5), and Bundler cannot continue. Make sure that gem install json -v '1.7.5' succeeds before bundling.

Gem文件将保留在/home/chris/.bundler/tmp/2984/gems/json-1.7.5中进行检查。结果登录到/home/chris/.bundler/tmp/2984/gems/json-1.7.5/ext/json/ext/generator/gem_make.out安装json(1.7.5)时发生错误,Bundler无法继续。在捆绑之前确保gem install json -v'1.7.5'成功。

The last part says to make sure gem install json -v '1.7.5' succeeds before bundling, so I run this command and json installs fine:

最后一部分是为了确保gem install json -v'1.7.5'在捆绑之前成功,所以我运行这个命令并且json安装正常:

Building native extensions. This could take a while...
Successfully installed json-1.7.5
1 gem installed
Installing ri documentation for json-1.7.5...
Installing RDoc documentation for json-1.7.5...

构建原生扩展。这可能需要一段时间......安装成功安装了json-1.7.5 1 gem安装json-1.7.5的ri文档...为json-1.7.5安装RDoc文档...

But if I try rake db:migrate it starts all over again with the same errors. I've read about issues with json on Mac, but have had no luck with any of those solutions. Any ideas?

但是,如果我尝试rake db:migrate,它会以相同的错误重新开始。我已经在Mac上阅读过关于json的问题,但是对于任何这些解决方案都没有运气。有任何想法吗?

I'm running Ubuntu 12.04LTS, ruby 1.9.3, rails 3.2.8, gem 1.8.15 (tried it with 1.9.1 also)

我正在运行Ubuntu 12.04LTS,ruby 1.9.3,rails 3.2.8,gem 1.8.15(也尝试使用1.9.1)

1 个解决方案

#1


1  

I think that you need to install the -dev package. Try running this command

我认为你需要安装-dev包。尝试运行此命令

sudo aptitude install ruby1.9.1-dev

and then bundle install should work.

然后捆绑安装应该工作。

#1


1  

I think that you need to install the -dev package. Try running this command

我认为你需要安装-dev包。尝试运行此命令

sudo aptitude install ruby1.9.1-dev

and then bundle install should work.

然后捆绑安装应该工作。