尝试运行应用程序时Ruby出现URI错误[已关闭]

6ss1mwsb  于 12个月前  发布在  Ruby
关注(0)|答案(1)|浏览(133)

**已关闭。**此问题需要debugging details。它目前不接受回答。

编辑问题以包括desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将帮助其他人回答这个问题。
上个月关门了。
Improve this question
因此,由于某些原因,当我尝试在Windows 10上创建新应用程序时,我Ruby遇到了此错误:

rails aborted!
URI::InvalidURIError: bad URI(is not URI?): C:\\Ruby\\bin;C:\\sqlite;
C:/Users/Lies/demo42/Rakefile:6:in `<main>' <internal:C:/Ruby/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
\<internal:C:/Ruby/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb\>:38:in `require' bin/rails:4:in `\<main\>'
(See full trace by running task with --trace)
rails  turbo:install stimulus:install
rails aborted!
URI::InvalidURIError: bad URI(is not URI?): C:\\Ruby\\bin;C:\\sqlite;
C:/Users/Lies/demo42/Rakefile:6:in `<main>' <internal:C:/Ruby/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
\<internal:C:/Ruby/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb\>:38:in `require' bin/rails:4:in `\<main\>'
(See full trace by running task with --trace)

我在Google上搜索了所有的地方,到目前为止,我已经尝试重新安装了两次,将路径变量改为C:\ruby,并将其添加到路径和数据库变量。
我的ruby,rails是最新版本。
到目前为止,运行“rails new demo --minimal”是唯一一个帮助我创建应用程序的方法,但是当我尝试运行服务器时,它显示:localhost:3000 output
有没有人遇到过这种情况,并找出如何解决?我问了我的教授,他也想弄清楚。

数据库.yml

# SQLite. Versions 3.8.0 and up are supported. 
# gem install sqlite3 
# Ensure the SQLite 3 gem is defined in your Gemfile 
# gem "sqlite3" 
#
default: &default 
  adapter: sqlite3 
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 
  timeout: 5000
development: 
  <<: *default 
  database: db/development.sqlite3 
# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
  <<: *default 
  database: db/test.sqlite3 
production: 
  <<: *default 
  database: db/production.sqlite3

编辑:对于未来的读者:下面是Database_URL_ env变量,有两个值“C:\sqlite”和“C:\Ruby\bin”,我稍后再次遇到这个问题,但通过编辑'Path' env变量,使其只包含ruby和git值,再次修复了这个问题。

hpcdzsge

hpcdzsge1#

因为你有DATABASE_URL env变量,Rails使用它作为优先数据库配置,并尝试解析它。但其值无效。这就是为什么你有错误
而不是使用config/database.yml来存储数据库设置并删除DATABASE_URL环境变量
阅读更多

相关问题