gpt4 book ai didi

AMD64 上的 ruby​​ postgreSQL

转载 作者:行者123 更新时间:2023-11-29 13:36:32 25 4
gpt4 key购买 nike

----------------编辑----------------

我已经尝试了@Duk 所说的,但仍然没有任何效果。多试了几次之后,我发现问题不在 DataMapper 上。事实上,在 AMD64 上失败的是 postgreSQL 适配器。

我有 PostgreSQL 的二进制发行版(在他们的网站上找到的最后一个),我通过做一个

gem install...

有人可以帮助我吗?

---------------- 原创----------------

按照 DataMapper 网站的“入门”,我遇到了这个例子:

# A Postgres connection:
DataMapper.setup(:default, 'postgres://localhost/the_database_name')

我安装了我的 postgre 数据库、DataMapper 和每个依赖项(包括开发工具包)这是代码:

gem 'data_mapper'
require 'dm-core'
require 'dm-migrations/adapters/dm-postgres-adapter'
# If you want the logs displayed you have to do this before the call to setup
DataMapper::Logger.new($stdout, :debug)

# A Postgres connection:
DataMapper.setup(:default, 'postgres://localhost/test')

但是当我运行它时,出现了这个错误:

D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': 193: %1 n?est pas une application Win32 valide.   - D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/do_postgres-0.10.8-x86-mingw32/lib/do_postgres/1.9/do_postgres.so (LoadError)
from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/do_postgres-0.10.8-x86-mingw32/lib/do_postgres.rb:30:in `rescue in <top (required)>'
from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/do_postgres-0.10.8-x86-mingw32/lib/do_postgres.rb:25:in `<top (required)>'
from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-postgres-adapter-1.2.0/lib/dm-postgres-adapter/adapter.rb:1:in `<top (required)>'
from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-postgres-adapter-1.2.0/lib/dm-postgres-adapter.rb:1:in `<top (required)>'
from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:163:in `load_adapter'
from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:133:in `adapter_class'
from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:13:in `new'
from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core.rb:228:in `setup'
from D:/dev/workspace/ruby/training/bin/pg/main.rb:8:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'

错误发生在“load_adapter”函数上:

    require "dm-#{name}-adapter"

显然找不到该文件。我已尝试按照建议手动包含适配器 here但没有成功。

有什么想法吗?谢谢

最佳答案

你必须安装 dm-postgres-adapter(gem install dm-postgres-adapter) 然后安装 data_mapper(gem install data_mapper)。

关于AMD64 上的 ruby​​ postgreSQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9472556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com