新手问题 Ubuntu 命令行问题 Rails 新项目 bundle install 的问题

wsybyy · September 14, 2017 · Last by ranshuang123 replied at November 23, 2017 · 1766 hits

我在 Ubuntu 里把 Ruby 以及 Rails 都安好了 新建了一个 Rails 项目 HelloRails,进入该文件夹后输入 rails server 命令行出现

Could not find gem 'rails (= 4.2.6)' in any of the gem sources listed in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.

这两行代码,于是我就执行了 bundle install,结果啪啦啪啦一大堆后,我以为可以成功启动服务器了,结果还是显示上面那两行 真心想学 Ruby,从 Windos 到 CentOS 到现在这个 Ubuntu,请老铁们指教指教下😊

bundle exec rails s

"啪啦啪啦一大堆" 是哪些内容?可能是你参考的教程比较老,而你安装的 rails 版本比较新

gem install rails -v 你的 rails 版本

Reply to rubyist518

还是弹出的我上面写的两行代码

Reply to chalvern

其中有行报错是 Failed to build gem native extension

Reply to tinyfeng

我输入这个命令会报这个错。。。 ERROR: While executing gem ... (OptionParser::MissingArgument) missing argument: -v

Reply to wsybyy

Failed to build gem native extension

贴详细错误

Reply to huacnlee

Installing json 1.8.6 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /tmp/bundler20170915-9009-cc0g2sjson-1.8.6/gems/json-1.8.6/ext/json/ext/generator /usr/bin/ruby2.3 -r ./siteconf20170915-9009-1lbtrll.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20170915-9009-cc0g2sjson-1.8.6/gems/json-1.8.6 for inspection. Results logged to /tmp/bundler20170915-9009-cc0g2sjson-1.8.6/extensions/x86-linux/2.3.0/json-1.8.6/gem_make.out Using minitest 5.10.3 Using thread_safe 0.3.6 Using builder 3.2.3 Using erubis 2.7.0 Using mini_portile2 2.2.0 Using rack 1.6.8 Using mime-types-data 3.2016.0521 Using arel 6.0.4 Installing debug_inspector 0.0.3 with native extensions

我之前好像遇到类似的问题,我找了很久发现我得 node.js 误删了,后来重新安装以后就好了

You need to Sign in before reply, if you don't have an account, please Sign up first.