运行rake命令时出现问题

时间:2013-11-19 18:53:00

标签: ruby-on-rails ruby

因此,我正在尝试使用jobsworth并遇到架构未正确生成的问题。我提交了一份报告,得到了“我们为下一个版本修好了”的股票回复(他们现在已经说了5个多月)以及使用rake的一个很好的小解决方法。羞辱rake命令不起作用。

所以我运行bundle install:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
checking for main() in -lc... yes
creating Makefile

make
sh: 1: make: not found


Gem files will remain installed in /var/lib/gems/1.9.1/gems/RedCloth-4.2.9 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out

An error occurred while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.

优秀。然后我尝试安装RedCloth:

ERROR:  Error installing RedCloth:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
checking for main() in -lc... yes
creating Makefile

make
sh: 1: make: not found


Gem files will remain installed in /var/lib/gems/1.9.1/gems/RedCloth-4.2.9 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out

我已经四处寻找许多解决方案,大多数都与Octopress或Mac上的错误有关,而且我没有使用它们,所以它们不是很有帮助。

3 个答案:

答案 0 :(得分:2)

错误是说未安装make。如果未安装,请安装它。如果已安装,请将包含make二进制文件的目录添加到$PATH,然后重试。

答案 1 :(得分:0)

通过Puppet部署我的项目时遇到同样的问题。

就我而言,即使存在make并且安装了所有相关库,$PATH也会为root和其他用户正确设置bundle installexec通过{{ 1}} Puppet中的资源(见下文)导致了同样的错误:

class bundler_run ($target) {
  exec { 'get bundle':
  path        => [ '/bin', '/usr/local/bin', '/var/lib/gems/1.9.1/bin' ],
  cwd         => $target,
  unless      => "bundle check > /dev/null",
  command     => 'bundle install --deployment --clean --without development test',
  logoutput   => true,
  }
}

我的解决方法是在Gemfile中明确设置PATH

ENV['PATH'] = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"

此外,将编码设置为UTF8,解决ArgumentError: invalid byte sequence in US-ASCII错误,

if RUBY_VERSION =~ /1.9/
  Encoding.default_external = Encoding::UTF_8
  Encoding.default_internal = Encoding::UTF_8
end

答案 2 :(得分:0)

这个命令解决了我的问题:

sudo apt-get install build-essential