【问题标题】:Rails won't installRails 无法安装
【发布时间】:2019-08-01 06:28:51
【问题描述】:

首先,我对 Rails 很陌生,我相信这个问题会显示出来。我正要按照 gorails.com 上的步骤设置本地服务器。当我可以访问互联网时,我也会在任何地方使用 codeanywhere。当我尝试安装 (rails new myapp) rails 时,我的终端命令不断收到以下错误

extconf failed, exit code 1

Gem files will remain installed in
/var/folders/0d/yx9wdh954jjbn_pnn5nbm5540000gn/T/bundler20190310-64475-5t7xkksqlite3-1.4.0/gems/sqlite3-1.4.0
for inspection.
Results logged to
/var/folders/0d/yx9wdh954jjbn_pnn5nbm5540000gn/T/bundler20190310-64475-5t7xkksqlite3-1.4.0/extensions/universal-darwin-17/2.3.0/sqlite3-1.4.0/gem_make.out

An error occurred while installing sqlite3 (1.4.0), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.4.0' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  sqlite3
         run  bundle exec spring binstub --all
Could not find gem 'uglifier (>= 1.3.0)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems."

任何有关此事的帮助将不胜感激。提前致谢。

【问题讨论】:

  • 您是否尝试按照错误消息中的建议运行bundle install

标签: ruby-on-rails ruby sqlite rubygems


【解决方案1】:

请在您的 ruby​​ rails 项目中编辑名为 Gemfile 的文件并更改以下内容

gem  'sqlite3'

gem 'sqlite3', '~> 1.3.11'

现在运行以下命令来安装 Gem

bundle install

现在运行你的 Rails 项目

rails s

【讨论】:

    【解决方案2】:

    我认为您缺少 sqlite3。 运行命令

    sudo apt-get install -y sqlite3 libsqlite3-dev
    

    然后修改gemfile为

    gem 'sqlite3', '~> 1.3.11'
    

    然后运行

    bundle install
    

    在 Rails 中,需要在本地安装一些包,然后才能将它们包含在 gemfile 中。这同样适用于mysqlpsql

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-14
      • 2019-09-09
      • 1970-01-01
      • 2012-09-20
      • 2012-05-31
      • 2012-03-28
      相关资源
      最近更新 更多