Ruby 2.0.0에서 Rails 4.0.0을 사용하여 기본 설치 및 서버 시작을 설정하려고하면 다음 오류 메시지가 표시됩니다.
/usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:2:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /home/penchal/new/site/config/application.rb:7:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
이 오류 메시지를 피하고 계속 진행하려면 어떻게해야합니까?
답변
sqlite3 gemspec 파일을 찾으십시오. 한 가지 예는 /usr/local/share/gem/specifications/sqlite3-1.3.7.gemspec
Windows :
C:\Ruby21\lib\ruby\gems\2.1.0\specifications
.
Rubygem 경로 및 sqlite3 버전에 따라 조정해야합니다. 위의 파일을 편집하고 다음 줄을 찾으십시오.
s.require_paths=["lib"]
그것을 변경
s.require_paths= ["lib/sqlite3_native"]
답변
참조 : https://stackoverflow.com/a/39136421/6755206
다행스럽게도 루비 2.0으로 전환 할 필요가 없습니다.
끝없는 노력 끝에이 문제에 대한 해결책이 있습니다.
https://github.com/hwding/sqlite3-ruby-win
단계
사전
gem uninstall sqlite3 --all
출처
- 최신 sqlite3-ruby, https://github.com/sparklemotion/sqlite3-ruby 다운로드
- 패키지 압축을 풉니 다
짓다
- 추출 된 디렉토리에서 명령 줄 실행
- C 컴파일러가 설치되어 있고 PATH에 추가되었는지 확인하십시오.
gem install bundler
bundle install
rake native gem
- 생성 된 ‘pkg’라는 이름의 dir을 찾을 수 있습니다.
설치
- 디렉토리 ‘pkg’를 입력하십시오.
gem install --local sqlite3-xxx.gem
( ‘xxx’는 버전 코드입니다.)
검사
irb
require 'sqlite3'
답변
이후 풀 요청 # 229 병합되었습니다, sqlite3를가 당 설치할 수 있습니다 git:
키를 누릅니다. 이 추가를 통해 sqlite3를 쉽게 사용할 수 있습니다 Gemfile
.
gem 'sqlite3', git: "https://github.com/sparklemotion/sqlite3-ruby"
이것은 RubyInstaller-2.4 이상에서 작동합니다. mingw-w64-x86_64-sqlite3
을 실행할 때 필요한 pacman 패키지를 자동으로 설치합니다 bundler install
.
RubyInstaller2 FAQ 에 Rails on Windows에 대한 몇 가지 힌트가 더 있습니다 .
답변
gem uninstall sqlite3 --all
ridk exec pacman -S mingw-w64-x86_64-sqlite3
gem inst sqlite3 --platform ruby
이것은 나에게 문제를 해결했습니다.
Windows 10
Ruby 2.5.3
Rails 5.2.2
답변
Gemfile을 편집하고 gem 'sqlite3', platform: :ruby
.
답변
소스를 컴파일하거나 미리 컴파일 된 라이브러리를 다운로드하면이 문제를 해결할 수 없습니다. 제가 모든 것을 시도했다고 믿습니다. 문제는 다른 곳에 있습니다. 이것은 Windows에서 작동하는 방법입니다.
bundle update sqlite3
nokogiri와 관련하여이 오류 후에 또 다른 유사한 오류가 발생할 수 있습니다. 다음 명령으로 수정하십시오.
bundle update nokogiri
Ruby 앱을 즐기십시오!
답변
sqlite3 gem을 제거하고 다시 설치하는 것이 저에게 효과적이었습니다.
gem uninstall sqlite3
bundle
![](http://daplus.net/wp-content/uploads/2023/04/coupang_part-e1630022808943-2.png)