ruby-on-rails - 警告:以 \r 结尾的 shebang 行可能会导致问题。导轨中止
问题描述
我正在rbenv
Ubuntu 18.04 上设置一个存在 Rails 项目。rbenv
版本是1.1.2-11-gc46a970
. 我.ruby-version
在项目根目录中添加了文件。当我运行时,rbenv version
我得到了正确版本的 Ruby。
现在的问题是当我运行rails s
或rails test:system
出现以下错误时:
/home/user/.rbenv/versions/2.5.0/bin/ruby: warning: shebang line ending with \r may cause problems rails aborted!
NameError: uninitialized constant URI::Generic
/home/my_project/config/application.rb:3:in `require'
/home/my_project/config/application.rb:3:in `<top (required)>'
/home/my_project/Rakefile:4:in `require_relative'
/home/my_project/Rakefile:4:in `<top (required)>'
/home/my_project/bin/rails:9:in `require'
/home/my_project/bin/rails:9:in `<top (required)>'
/home/my_project/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
(See full trace by running task with --trace)
但我不知道如何解决这个问题(因为我是 Ruby Rails 的新手。)
编辑
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Dingoapp
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
config.time_zone = 'London'
config.serve_static_files = true
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
解决方案
推荐阅读
- azure - 如何指定“Azure SQL 发布”任务 SQL 脚本?
- r - 如果在 CSV 文件中提供数据,则在 Perl 或 R 中创建矩阵
- graphql - 编写解析器来转换案例
- adapter - 哪个适配器连接?网盘
- ios - 如何生成 Google Place API 会话令牌?
- linux - 在 shell 中以另一个用户身份运行时无法初始化变量
- html - mailchimp 隐藏输入字段
- pandas - Pandas - 尝试合并分组数据框
- twitter-bootstrap - 视差左侧编号仅在活动动画线部分显示。一次只能看到一个数字
- laravel-5 - Laravel如何使用Postgres SQL获取数据随机行?