Rails 不会安装

Rails won't install

首先,我是 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."

如有任何帮助,我们将不胜感激。提前致谢。

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

gem  'sqlite3'

gem 'sqlite3', '~> 1.3.11'

现在运行按照命令安装Gem

bundle install

现在 运行 你的 rails 项目

rails s

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

sudo apt-get install -y sqlite3 libsqlite3-dev

然后修改gemfile为

gem 'sqlite3', '~> 1.3.11'

然后运行

bundle install

在rails中,一些包需要安装到您的本地,然后它们可以包含在您的gemfile 中。这同样适用于 mysqlpsql