development

이러한 파일을로드 할 수 없습니다 — sqlite3 / sqlite3_native (LoadError) on ruby ​​on rails

big-blog 2020. 9. 23. 07:53
반응형

이러한 파일을로드 할 수 없습니다 — sqlite3 / sqlite3_native (LoadError) on ruby ​​on rails


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

출처

짓다

  • 추출 된 디렉토리에서 명령 줄 실행
  • 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.


No compiling of the sources or downloading pre-compiled libraries will solve this problem, believe me I tried everything, the problem lies somewhere else. This is how it works on windows:

bundle update sqlite3

You likely get another similar error after this one regarding nokogiri, fix it with the command:

bundle update nokogiri

Enjoy your Ruby App!


Uninstalling and reinstalling the sqlite3 gem worked for me.

gem uninstall sqlite3

bundle

This worked for me:

gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"

BEST OFFICIAL INSTALL

Im using rails 5.2.1p57, Windows 10 Just running following lines sloved the problem

gem uninstall sqlite3

and uninstall all installed versions. again execute following command

gem install sqlite3 --platform=ruby

You are now done. Let me know if problem persist.


If the top answer doesn't work, a fix that I discovered is simply going to your Gemfile and adding the version number 1.3.11 (instead of 1.3.9) right after sqlite3. So the line in your Gemfile should now read:

# Use sqlite3 as the database for Active Record
gem 'sqlite3',  '1.3.11'

I had the same error when I upgrade my Ruby version to 2.5.X. I tracked with rails task --trace that the sqlite3 is not available to version 2.5, than I change my GemFile the gem "sqlite3" change to "sqlite3-ruby", after I uninstall the gem "sqlite3" and finally I run the bundle install.

I don't know what is the reason... I read that "sqlite3" is not available for ruby 2.5 yet, but I'm not sure.


To avoid this error, ensure that gem sqlite3 is added to your Gemfile. Then extract "exe"s and "dll"s from Sqlite download link to Ruby's bin folder. If problem still persists. Try this:

bundle update

gem uninstall sqlite3

Given a choice between multiple versions of sqlite3, choose last option 'All versions'. Enter last number here

Select gem to uninstall:
1. sqlite3-1.3.13
2. sqlite3-1.3.13-x64-mingw32
3. All versions
>3 .
.
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]
> y

gem install sqlite3 --platform=ruby

rails s

This should work.

Read through this link for more explanation if above works for you.


This happened to me as well. It turned out that I had originally installed SQLite 1.3.10, but then I copied some gems from the Rails tutorial screencasts project and it listed SQLite 1.3.9. Then I got the same error you did. I changed it back to 1.3.10 and it worked.

(This is on Windows 7. I was running the screencast tutorial on Cloud9 IDE).


This is the only solution worked for me, derived from this GitHub issue post:

  1. Get autoconf version of sqlite3 sources from https://www.sqlite.org/download.html.
  2. Start MSYS shell.
  3. In unpacked location for your sqlite3, configure static version only to avoid keeping DLL on PATH: ./configure --disable-shared.
  4. Build and install it: make install DESTDIR=/c/dev/ruby/tmp. You can change the directory.
  5. Open command prompt of windows and run gem uninstall sqlite3 --all to remove all existing sqlite3 gems.
  6. Again on command prompt of windows, build and install sqlite3 gem: gem install sqlite3 --platform=ruby -- --with-sqlite3-include=C:\dev\ruby\tmp\usr\local\include --with-sqlite3-lib=C:\dev\ruby\tmp\usr\local\lib. Those include and lib directories may be different, so check at first.

I am using Ruby version 2.5.1 and Rails version 5.2.0 on Windows 10.


Updated

Adding the below to the Gemfile fixed for me: gem 'sqlite3', '1.4.0', platforms: :ruby


i found it! i saw this https://www.youtube.com/watch?v=lsrzvX0qzmA
i instaled: Rails version: 5.2.1 Ruby version: 2.5.3 (x64-mingw32) Sqlite version 1.3.13
and i have your problem... my solution:

  1. In your installing folder like C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\
    you have folders: "sqlite3-1.3.13" "sqlite3-1.3.13-x64-mingw32"
  2. Find file
    C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\sqlite3-1.3.13\lib\sqlite3\sqlite3_native.so
  3. Copy it in C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\sqlite3-1.3.13-x64-mingw32\lib\sqlite3\2.5\sqlite3_native.so (may be folders not exist - create and paste)

For OSX users, this can result from using a ruby manager (e.g. rvm).

If you edit your ~/.bash_profile and add this:

[[ "$APP" = *"/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/"* ]] && {
  echo Xcode detected
  rvm use system
}

You can work around the issue. Restart Xcode before attempting to build again.

The actual issue is tracked here: https://openradar.appspot.com/28726736).

Full credit goes to: https://egeek.me/2018/04/14/ipa-export-error-in-xcode-and-ruby/


Change your sqlite3 gem in the Gemfile for this:

gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"

Then run:

bundle install

참고URL : https://stackoverflow.com/questions/17643897/cannot-load-such-file-sqlite3-sqlite3-native-loaderror-on-ruby-on-rails

반응형