我找到了project on GitHub,但我在运行它时遇到了问题。有人可以尝试让我知道如何做到这一点吗?
我下载了项目,在rails上启动了一个新项目,转到myapp /并尝试rails s
但是它没有启动。
我安装了所有宝石,现在它向我显示了这个错误:C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.13-x64-mingw32/lib/sqlite3.rb:6:in require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
像这样看我的gemfile
source 'https://rubygems.org'
git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "https://github.com/#{repo_name}.git" end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.4'
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0'
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.7' gem 'sqlite3', '~> 1.3', '>= 1.3.13' gem 'jquery-rails' gem 'jquery-migrate-rails' gem 'pg' gem 'devise', '~> 4.4', '>= 4.4.1' gem 'redactor-rails', '~> 0.5.0' gem 'carrierwave', '~> 1.2', '>= 1.2.2' gem 'mini_magick', '~> 4.8'
#gem 'kaminari' gem 'activeadmin', '~> 1.2', '>= 1.2.1' gem 'ransack' gem 'delayed_job_active_record' gem 'slim' gem 'omniauth' gem 'omniauth-facebook' gem 'acts-as-taggable-on'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] # Adds support for Capybara system testing and selenium driver gem 'capybara', '~> 2.13' gem 'selenium-webdriver' end
group :development do # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. gem 'web-console', '>=
3.3.0' end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
错误:
C:\Users\User\Desktop\myapp>rails s Traceback (most recent call last):
22: from bin/rails:4:in `<main>'
21: from bin/rails:4:in `require'
20: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
19: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
18: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
17: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
16: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
15: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
14: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
13: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
12: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `block in perform'
11: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `require'
10: from C:/Users/User/Desktop/myapp/config/application.rb:7:in `<top (required)>'
9: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler.rb:114:in `require'
8: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:65:in `require'
7: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:65:in `each'
6: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:76:in `block in require'
5: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:76:in `each'
4: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
3: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:81:in `require'
2: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.13-x64-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.13-x64-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.13-x64-mingw32/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
答案 0 :(得分:0)
基本上要让任何回购工作在本地, 您需要检查的第一件事是Gemfile和Database.yml
以下是步骤
将zip和Extract下载到您想要的位置。
打开项目并转到database.yml并使用正确的数据库适配器,用户名和密码(适用于所有环境)在测试环境中使用sqlite3。您可以将其更改为postgresql以解决错误。
在gem文件中包含您用作数据库的gem。如果您使用mysql2作为适配器,那么在Gemfile中添加该gem。
捆绑安装。(这将产生新的依赖关系,如果你在这里得到版本控制错误然后删除Gemfile.lock并再次捆绑安装[试试这个作为最后的尝试,尽管不推荐])
rake db:create and rake db:migrate
然后按s