python - 如何修复 ruby 错误: sh: 1: make: not found

标签 python ruby django chef-infra vagrant

我正在学习 http://gettingstartedwithdjango.com/en/lessons/introduction-and-launch/ 上的视频教程

我正在 win7 上工作,并在我的终端上使用 git-bash。我已经安装了最新的 virtualbox - 4.2.12 和最新的 vagrant - 1.22。

我尝试运行 vagrant up 并得到:

  $ vagrant up
  Bringing machine 'default' up with 'virtualbox' provider...
  [default] Setting the name of the VM...
  [default] Clearing any previously set forwarded ports...
  [default] Creating shared folders metadata...
  [default] Clearing any previously set network interfaces...
  [default] Preparing network interfaces based on configuration...
  [default] Forwarding ports...
  [default] -- 22 => 2222 (adapter 1)
  [default] -- 8000 => 8888 (adapter 1)
  [default] Booting VM...
  [default] Waiting for VM to boot. This can take a few minutes.
  [default] VM booted and ready for use!
  [default] Configuring and enabling network interfaces...
  [default] Mounting shared folders...
  [default] -- /vagrant
  [default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks
  [default] -- /tmp/vagrant-chef-1/chef-solo-2/cookbooks
  [default] Running provisioner: shell...
  [default] Running: inline script
  stdin: is not a tty
  ERROR:  Error installing chef:
          ERROR: Failed to build gem native extension.      

          /usr/bin/ruby1.8 extconf.rb
  creating Makefile      

  make
  sh: 1: make: not found    


  Gem files will remain installed in /var/lib/gems/1.8/gems/yajl-ruby-1.1.0 for in
  spection.
  Results logged to /var/lib/gems/1.8/gems/yajl-ruby-1.1.0/ext/yajl/gem_make.out
  Building native extensions.  This could take a while...
  The following SSH command responded with a non-zero exit status.
  Vagrant assumes that this means the command failed!      

      chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell

当我这样做时:

$ which make

我得到:

/c/opscode/chef/embedded/bin/make

所以看起来 make 在文件路径中

我该如何解决这个问题?

附录:当我将 vagrantfile 编辑为:

config.vm.provision :shell, :inline => "curl -L https://opscode.com/chef/install.sh | bash"

我得到:

/tmp/vagrant-shell: line 1: curl: command not found

最佳答案

您使用的 basebox 默认情况下没有安装“build-essential”软件包,但它有一个“shell provisioner ”,用于将 Chef gem 安装到默认的 Ruby 环境中。 Chef 依赖于 JSON RubyGem,它本身具有必须编译的 C 扩展。这就是 make 正在寻找的内容。

要解决此问题,我建议使用 Opscode 的“omnibus”full stack installer for Chef 。可以通过将 shell 配置程序行更改为:

config.vm.provision :shell, :inline => "curl -L https://opscode.com/chef/install.sh | bash"

或者,如果您的basebox没有curl,请使用wget:

config.vm.provision :shell, :inline => "wget -O https://opscode.com/chef/install.sh | bash"

[install.sh][3] 脚本只是检查虚拟机以确定其平台是什么,以便它可以从 S3 存储桶检索正确的 URL。如果您愿意,可以使用构建的 URL 直接下载 .deb 文件:

https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/11.04/x86_64/chef_11.4.4-2.ubuntu.11.04_amd64.deb

然后安装它:

dpkg -i chef_11.4.4-2.ubuntu.11.04_amd64.deb

请参阅 shell provisioners 上的 Vagrant 文档了解如何将其编写为小脚本。

关于python - 如何修复 ruby 错误: sh: 1: make: not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17119003/

相关文章:

ruby - 用于 SQL 脚本的 ORM

Django 说端口已被使用

python - 使用python从Hive检索数据时出错

ruby - Ruby 性能中的计时器

python - CET 和 CEST 转换为 UTC

ruby-on-rails - 渲染局部图像并将其传递给对象时,如何将 Assets 中的图像显示为背景图像

python - django模板显示项目值或空字符串

javascript - Django Admin 弹出功能

python - 有没有办法缩短多个条件,如下所示?

python - requests - Python 命令行行为不同于运行脚本时的行为