我正在学习 Ruby on Rails 教程 (Rails 5) Learn Web Development with Rails Michael Hartl,使用 rails 5.0.0.1,当我尝试在 bash 中运行以下命令时
rails generate scaffold User name:string email:string
我收到这个错误
Version: 1.7.2
Usage: spring COMMAND [ARGS]
Commands for spring itself:
binstub Generate spring based binstubs. Use --all to generate a binstub for all known commands. Use --remove to revert.
help Print available commands.
server Explicitly start a Spring server in the foreground
status Show current status.
stop Stop all spring processes for this project.
Commands for your application:
rails Run a rails command. The following sub commands will use spring: console, runner, generate, destroy, test.
rake Runs the rake command
rails aborted!
Don't know how to build task 'rails' (see --tasks)
/home/Medo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/rake_proxy.rb:13:in `block in run_rake_task'
/home/Medo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/rake_proxy.rb:10:in `run_rake_task'
/home/Medo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/home/Medo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:9:in `require'
bin/rails:9:in `<main>'
(See full trace by running task with --trace)
我不知道是什么导致了这个问题,经过一个小时的搜索也没有找到解决方案。
最佳答案
这对我有用
捆绑安装 --binstubs
之后,rails 就没有问题了
关于ruby-on-rails - 不知道如何构建任务 'rails',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39326485/