首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >码头依赖问题: Rake中止!LoadError:无法加载这样的文件-sqlite3 3/sqlite3 3_本机

问码头依赖问题: Rake中止!LoadError:无法加载这样的文件-sqlite3 3/sqlite3 3_本机
EN

Stack Overflow用户
提问于 2016-03-10 04:11:01
回答 1查看 2.1K关注 0票数 3

我有一些问题试图解决这个依赖问题。我在我的see文件中有sqlite3,我可以看到它被安装了,即使我运行gem list (在我的停靠容器中)。但是,当我使用docker生成依赖项时,然后在容器中运行我的项目时,在尝试运行rake test时会出现以下错误

代码语言:javascript
复制
 root@401a61839c07:/app# rake test
    rake aborted!
    LoadError: cannot load such file -- sqlite3/sqlite3_native

这里是构建,您可以清楚地看到sqlite是安装的。

代码语言:javascript
复制
docker build -f DependenciesDockerfile -t visual-base .
.
.
.
Step 12 : RUN bundle install --without development
---> Running in 623d8b439808
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Installing rake 10.5.0
Installing i18n 0.7.0
Installing json 1.8.3
Installing minitest 5.8.4
Installing thread_safe 0.3.5
Installing tzinfo 1.2.2
Installing activesupport 4.1.6
Installing builder 3.2.2
Installing erubis 2.7.0
Installing actionview 4.1.6
Installing rack 1.5.5
Installing rack-test 0.6.3
Installing actionpack 4.1.6
Installing mime-types 2.99.1
Installing mail 2.6.3
Installing actionmailer 4.1.6
Installing activemodel 4.1.6
Installing arel 5.0.1.20140414130214
Installing activerecord 4.1.6
Installing execjs 2.6.0
Installing autoprefixer-rails 6.3.3.1
Installing bcrypt 3.1.11
Installing sass 3.2.19
Installing bootstrap-sass 3.3.5
Installing climate_control 0.0.3
Installing cocaine 0.5.8
Installing coffee-script-source 1.10.0
Installing coffee-script 2.4.1
Using thor 0.19.1
Installing railties 4.1.6
Installing coffee-rails 4.0.1
Installing jquery-rails 3.1.4
Using bundler 1.8.0
Installing hike 1.2.3
Installing multi_json 1.11.2
Installing tilt 1.4.1
Installing sprockets 2.12.4
Installing sprockets-rails 2.3.3
Installing rails 4.1.6
Installing commontator 4.10.5
Installing orm_adapter 0.5.0
Installing responders 1.1.2
Installing warden 1.2.6
Installing devise 3.5.6
Installing devise-bootstrap-views 0.0.8
Installing gretel 3.0.8
Installing jbuilder 2.4.1
Installing kgio 2.10.0
Installing mimemagic 0.3.0
Installing net-ldap 0.14.0
Installing paperclip 4.3.5
Installing pg 0.18.4
Installing polyamorous 1.1.0
Installing raindrops 0.16.0
Installing rdoc 4.2.2
Installing rmagick 2.13.3
Installing sass-rails 4.0.5
Installing sdoc 0.4.1
Installing sqlite3 1.3.11
Installing squeel 1.2.3
Installing turbolinks 2.5.3
Installing uglifier 2.7.2
Installing unicorn 5.0.1
Bundle complete! 28 Gemfile dependencies, 63 gems now installed.
Gems in the group development were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Post-install message from rmagick:
Please report any bugs. See https://github.com/gemhome/rmagick/compare/RMagick_2-13-2...master and https://github.com/rmagick/rmagick/issues/18
 ---> 901bbde8aa4f
Removing intermediate container 623d8b439808
Successfully built 901bbde8aa4f

2.2.3 in visual-automation/ on master 
› docker build -t visual .                                                                  
Sending build context to Docker daemon 112.3 MB
Step 1 : FROM visual-base
 ---> 901bbde8aa4f
Step 2 : MAINTAINER
 ---> Running in bd02c1f718e7
 ---> 02f76881207c
Removing intermediate container bd02c1f718e7
Step 3 : ADD . /app
 ---> 4f80ec7fccce
Removing intermediate container 6d73bdc55fde
Step 4 : RUN sed -i.bak 's/user www-data;/user root;/g' /etc/nginx/nginx.conf
 ---> Running in df22155ce2b7
 ---> aa9442d89c9e
Removing intermediate container df22155ce2b7
Step 5 : EXPOSE 80
 ---> Running in f839dd6707ce
 ---> d197974fa925
Removing intermediate container f839dd6707ce
Successfully built d197974fa925

2.2.3 in repo/ on master 
› docker run -it visual /bin/bash                                                           
root@401a61839c07:/app# rake test
rake aborted!
LoadError: cannot load such file -- sqlite3/sqlite3_native
/app/vendor/cache/ruby/2.2.0/gems/sqlite3-1.3.11/lib/sqlite3.rb:6:in `require'
/app/vendor/cache/ruby/2.2.0/gems/sqlite3-1.3.11/lib/sqlite3.rb:6:in `rescue in <top (required)>'
/app/vendor/cache/ruby/2.2.0/gems/sqlite3-1.3.11/lib/sqlite3.rb:2:in `<top (required)>'
/app/config/application.rb:7:in `<top (required)>'
/app/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- sqlite3/2.2/sqlite3_native
/app/vendor/cache/ruby/2.2.0/gems/sqlite3-1.3.11/lib/sqlite3.rb:4:in `require'
/app/vendor/cache/ruby/2.2.0/gems/sqlite3-1.3.11/lib/sqlite3.rb:4:in `<top (required)>'
/app/config/application.rb:7:in `<top (required)>'
/app/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
root@401a61839c07:/app# 

下面是在容器中运行时gem list的输出

代码语言:javascript
复制
root@69296d7eec2a:/app# gem list     

*** LOCAL GEMS ***

actionmailer (4.1.6)
actionpack (4.1.6)
actionview (4.1.6)
activemodel (4.1.6)
activerecord (4.1.6)
activesupport (4.1.6)
arel (5.0.1.20140414130214)
autoprefixer-rails (5.2.1.1)
bcrypt (3.1.10)
bigdecimal (1.2.6)
bootstrap-sass (3.3.5)
builder (3.2.2)
bundler (1.8.0)
climate_control (0.0.3)
cocaine (0.5.8)
coffee-rails (4.0.1)
coffee-script (2.4.1)
coffee-script-source (1.9.1.1)
commontator (4.10.5)
devise (3.5.1)
devise-bootstrap-views (0.0.5)
dotenv (1.0.2)
erubis (2.7.0)
execjs (2.5.2)
foreman (0.77.0)
gretel (3.0.8)
hike (1.2.3)
i18n (0.7.0)
io-console (0.4.3)
jbuilder (2.3.1)
jquery-rails (3.1.3)
json (1.8.3, 1.8.1)
kgio (2.9.3)
mail (2.6.3)
mime-types (2.6.1)
mimemagic (0.3.0)
minitest (5.8.4, 5.4.3)
multi_json (1.11.2)
net-ldap (0.11)
orm_adapter (0.5.0)
paperclip (4.3.5)
pg (0.18.3)
polyamorous (1.1.0)
power_assert (0.2.2)
psych (2.0.8)
rack (1.5.5)
rack-test (0.6.3)
rails (4.1.6)
railties (4.1.6)
raindrops (0.15.0)
rake (10.4.2)
rdoc (4.2.0)
responders (1.1.2)
rmagick (2.13.3)
sass (3.2.19)
sass-rails (4.0.5)
sdoc (0.4.1)
sprockets (2.12.4)
sprockets-rails (2.3.2)
sqlite3 (1.3.11)
squeel (1.2.3)
test-unit (3.0.8)
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
turbolinks (2.5.3)
tzinfo (1.2.2)
uglifier (2.7.1)
unicorn (4.9.0)
warden (1.2.3)

我已经看到了编辑宝石规范的临时解决方案,但是一旦修复了其中一个,就会出现另一个类似的错误。我一定是漏掉了什么东西,但似乎一切都井井有条。

任何帮助都将不胜感激。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-03-17 19:38:13

从红宝石https://github.com/sparklemotion/sqlite3-ruby的文档中可以看出

这个模块允许Ruby程序与SQLite3数据库引擎(www.sqlite.org)接口。您必须安装SQLite引擎才能构建此模块。

我认为这里的问题是您的停靠容器没有安装sqlite3引擎,所以当gem试图调用本机代码时,它不能。

验证您的Dockerfile中有一个类似于RUN apt-get sqlite3的行。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35907435

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档