【问题标题】:'bundle install' not working in rails“捆绑安装”在 Rails 中不起作用
【发布时间】:2012-12-28 08:18:24
【问题描述】:

我通过rails new app 创建了一个新的rails 项目。然后命令提示符显示了一些文件的创建,然后显示run bundle install,然后显示了一些东西。

但是,然后我更改了 Gemfile 以添加一些新的 gem,并再次运行 bundle install 来安装这些 gem,但我收到了 invalid argument 错误。那么,如何运行 bundle install 呢?

Rails 版本:3.2.1, 红宝石版本:1.9.3

这是 Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.1'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'


# 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'

  gem 'uglifier', '>= 1.0.3'
end

group :development do
  gem 'rspec-rails', '2.0.0.beta.18'
end

group :test do
    gem 'rspec', '2.0.0.beta.18'
end

gem 'jquery-rails'

更新

事实证明,我之前安装了一个叫做 MoSync 的东西,它可能附带了一个 bundle 命令。所以,当我输入 bundle install 时,它试图运行其他东西但找不到有效的参数。

当我在 powershell 中输入 bundle 并看到以下内容时,这一点变得清晰:

MAUtil::MAFS Bundle tool

This tool is used to build a binary image of a folder on a desktop computer.

Usage:
bundle <parameters>

Parameters:
  -in <input file or folder> the input files or folders to add to the
                             image (multiple -in directives may be added).
  -out <output file>         the name of the image to be created (only one).
  -toUpper/-toLower          change case of all file names to upper or lower
                             case.

Example:
  bundle -in data -out anotherworld.bun -toLower

【问题讨论】:

  • 向我们展示您的 Gemfile,很可能其中有错误。还向我们展示实际的错误输出。你没有给我们足够的信息来帮助你,我们无法猜测:)
  • @Agis 错误仅此而已。两个字,就是。
  • rspec-rails vresion 字符串中有错字:'bete' 而不是 'beta'。我不确定是不是问题,但你可以试试:)。
  • @Jatin 没有线路错误?奇怪.. 试试bundle show。你是如何安装 Bundler 的?您的 rspec gem 中也有错误(bete 应该是 beta)。
  • @Agis 我使用了 rails 安装程序(railsinstaller.org)。它为我安装了捆绑器。即使在删除错字后也会出现错误。

标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2


【解决方案1】:

您需要使用doskey 创建别名:

doskey bundull=C:\ruby\bin\bundle
bundull install

或者使用完整路径运行:

C:\ruby\bin\bundle install

请注意,C:\ruby\ 应更改为您安装 Rails Installer 的路径。

您还可以通过转到“控制面板 > 系统 > 环境变量(底部的按钮)”然后编辑路径并移动路径来调整路径并使 C:\ruby\ 最重要将 Rails 安装程序升级到更高的位置(在其他任何事情之前)。执行此方法将防止将来出现 Rails 错误,但有时您必须调整路径,因为安装时其他东西可以调整您的路径。

【讨论】:

    【解决方案2】:
    MAUtil::MAFS Bundle tool
    
    This tool is used to build a binary image of a folder on a desktop computer.
    
    Usage:
    bundle <parameters>
    
    Parameters:
      -in <input file or folder> the input files or folders to add to the
                                 image (multiple -in directives may be added).
      -out <output file>         the name of the image to be created (only one).
      -toUpper/-toLower          change case of all file names to upper or lower
                                 case.
    
    Example:
      bundle -in data -out anotherworld.bun -toLower
    

    从 Mosync 执行的捆绑命令。 检查此链接。 http://www.mosync.com/docs/sdk/cpp/guides/storage/mafs-library/index.html

    [解决方案 1] 从 SYSTEM PATH 中移除 Mosync,然后再次尝试使用 bundle。

    [解决方案 2] 直接访问 ruby​​ 的 bundle

    C:\Ruby193\bin\bundle install
    

    【讨论】:

      【解决方案3】:

      似乎您正在运行 Windows 操作系统。也许它可能是某个地方的隐藏角色?最简单的方法是安装 RVM(Ruby 版本管理器)之类的东西。我相信它是适用于 Windows 的 Pik(https://github.com/vertiginous/pik/)。再次尝试安装。

      还可以尝试删除

      中“beta”之后的所有内容

      2.0.0.beta.18

      实现它

      gem 'rspec-rails', '2.0.0.beta'

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-10-31
        • 2023-03-15
        • 2016-11-19
        • 1970-01-01
        相关资源
        最近更新 更多