Windows 10에서 "rails server"명령을 실행할 때 "cannot load such file--sqlite3/sqlite3 native"오류 발생

4437 단어 RubyRails

개시하다


제목의 오류에 대응하는 방법.
처리 방법은 여기 @jun.모카의 보도와 같다.감사합니다m
그래서 이것은 자신이 쓴 필기다.

컨디션

  • Windows10
  • RubbyInstaller 설치Ruby+Devkit 2.5.3-1 (x64)
  • ruby 2.5.3p105 (2018-10-18 revision 65156) [x64-mingw32]
  • Rails 5.2.2
  • 잘못


    Rails를 설치한 후rails new hoge 프로젝트를 만들었다hoge.hoge 디렉토리로 이동하여 rails server 명령으로 Rails 응용 프로그램을 실행한 결과 다음 오류 메시지를 출력하여 실행할 수 없습니다.
    Traceback (most recent call last):
            43: from bin/rails:4:in `<main>'
            42: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
            41: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
            40: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
    
    <<中略>>
    
    
    C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
    
    sqlite3의 불러오는 데 실패한 것 같습니다.

    해결 프로그램

  • sqlite3.Path가 통과하는 디렉토리에 dll 배치
  • sqlite3_native.so 파일 생성
  • sqlite3_native.so 파일 구성
  • 1. sqlite3.Path 통과 디렉토리에 dll 배치


    SQLite Download Page
    "sqlite-dll-win64-x64-360000.zip"에서 다운로드하십시오.
    내 Windows는 64bit이므로 64bit를 선택했습니다.

    해동하면 Path가 통과하는 디렉토리로 복사하는 sqlite3.dll 이 표시됩니다.
    Path만 통과하면 어디든지 가능한데 이번에는 루비의 설치 디렉토리에 있는'bin'디렉토리에 넣었습니다.C:\Ruby25-x64\bin

    2. sqlite3_native.so 파일 생성


    아까와 같이SQLite Download Page'sqlite-amalgamation-360000.zip'을 다운로드하세요.

    이거 풀게요.
    다음 명령을 실행하여 파일을 생성합니다sqlite3_native.so.
    gem install sqlite3 --platform=ruby -- --with-sqlite3-include=C:/sqlite-amalgamation-3260000 --with-sqlite3-lib=C:\Ruby25-x64\bin
    
    이렇게 하면 C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\sqlite3-1.3.13\lib\sqlite3\sqlite3_native.so 파일이 생성됩니다.

    3. sqlite3_native.so 파일 구성

    RubyInstaller 중 64비트를 선택할 때 C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\sqlite3-1.3.13-x64-mingw32 디렉터리가 있어야 한다.qlite의 버전이 다를 수 있습니다.
    거기서 앞으로 가면 C:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\sqlite3-1.3.13-x64-mingw32\lib\sqlite3안에 숫자 목록이 몇 개 있을 거예요.
    2.4.
    새 디렉토리2.5를 만들고 이전 디렉토리sqlite3_native.so를 복사합니다.
    그게 다야.

    확인


    다시 rails server 명령을 실행합니다.
    그래서 이번에는 다음과 같이 Rails 응용 프로그램의 시작이 성공했습니다.
    => Booting Puma
    => Rails 5.2.2 application starting in development
    => Run `rails server -h` for more startup options
    *** SIGUSR2 not implemented, signal based restart unavailable!
    *** SIGUSR1 not implemented, signal based restart unavailable!
    *** SIGHUP not implemented, signal based logs reopening unavailable!
    Puma starting in single mode...
    * Version 3.12.0 (ruby 2.5.3-p105), codename: Llamas in Pajamas
    * Min threads: 5, max threads: 5
    * Environment: development
    * Listening on tcp://0.0.0.0:3000
    Use Ctrl-C to stop
    
    브라우저localhost:3000에 액세스하면 다음 페이지가 성공적으로 표시됩니다.

    Yes! I'm on Rails!

    좋은 웹페이지 즐겨찾기