我在WSL上工作,研究Ruby on Sinatra Web应用程序培训,当我在heroku运行控制台命令上需要'./main'时,我得到LoadError并且它不能要求'dm-postgres-adapter。
我一直在使用WSL跟踪一个教程,我安装了Ruby及其依赖项,到目前为止我安装的所有gem都是成功的。但是当我推送到heroku并且当我运行'heroku run console'命令时,我输入'require'./main“'我得到一个LoadError,告诉我......
joelg@SurfacePro3:~/RubyProgs/SinatraExcercise$ heroku run console
Running console on ⬢ sinatra-project-jg... up, run.2550 (Free)
irb(main):001:0> require './main'
WARNING: If you plan to load any of ActiveSupport's core extensions to Hash, be sure to do so *before* loading Sinatra::Application or Sinatra::Base. If not, you may disregard this warning. LoadError: cannot load such file -- dm-postgres-adapter from /app/vendor/bundle/ruby/2.4.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:163:in `require' from /app/vendor/bundle/ruby/2.4.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:163:in `load_adapter' from /app/vendor/bundle/ruby/2.4.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:133:in `adapter_class' from /app/vendor/bundle/ruby/2.4.0/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:13:in `new' from /app/vendor/bundle/ruby/2.4.0/gems/dm-core-1.2.1/lib/dm-core.rb:230:in `setup' from /app/main.rb:21:in `block in ' from /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.4/lib/sinatra/base.rb:1426:in `configure' from /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.4/lib/sinatra/base.rb:1925:in `block (2 levels) in delegate' from /app/main.rb:20:in `' from (irb):1:in `require' from (irb):1 from /app/bin/irb:15:in `' irb(main):002:0>
当我运行它说不需要dm-postgres-adapter,但它是我把它加载到我的Gemfile上。
我得到了同样的错误。当你推送到heroku时,不要忽略Heroku的警告。
如果你正在使用Git(你可能是),你需要先通过命令行删除.bundle /文件夹:
git rm --cached -r .bundle /
然后你需要在主目录中添加一个.gitignore文件,文件正文中有“.bundle /”
将它全部提交给git和/或github。推送到Heroku。 (没有更糟糕的警告RE .bundle /文件夹)
然后运行你的heroku运行控制台命令,再次使用Jumpstart教程。