无法为 Rails 4.2、Ruby 2.1.4 生成任何迁移.bin/rails 中的语法错误 [英] Cannot generate any migrations for Rails 4.2, Ruby 2.1.4. Syntax error in bin/rails

查看:31
本文介绍了无法为 Rails 4.2、Ruby 2.1.4 生成任何迁移.bin/rails 中的语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试创建迁移时,都会收到以下错误.有谁知道是什么原因造成的?

Whenever I try to create a migration, I get the following error. Does anyone know what could be causing this?

$ rails generate migration NewMigration
/Users/myuser/.rvm/gems/ruby-2.1.4/bin/ruby_executable_hooks:15:in `eval': /Users/myuser/.rvm/gems/ruby-2.1.4/bin/rails:19: syntax error, unexpected '=', expecting keyword_end (SyntaxError) /Users/myuser/.rvm/gems/ruby 2.1.4/bin/rails:23: syntax error, unexpected end-of-input, expecting keyword_end
from /Users/myuser/.rvm/gems/ruby-2.1.4/bin/ruby_executable_hooks:15:in `<main>'

推荐答案

你的 bin/rails 文件不知何故被修改了.在您之前使用的同一个 rvm 中运行 gem pristine -a.这将重建/重新安装您的所有 gem 文件.

Somehow your bin/rails file got modified. Run gem pristine -a in the same rvm you were using before. This rebuilds / reinstalls all your gem files.

这篇关于无法为 Rails 4.2、Ruby 2.1.4 生成任何迁移.bin/rails 中的语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆