简体   繁体   English

启动Rails服务器时未初始化的常量Formtastic :: SemanticFormBuilder(NameError)

[英]uninitialized constant Formtastic::SemanticFormBuilder (NameError) when starting rails server

I was trying to start my rails server, but I am getting the following error: 我试图启动我的Rails服务器,但出现以下错误:

/config/initializers/formtastic.rb:27:in `': uninitialized constant Formtastic::SemanticFormBuilder (NameError) /config/initializers/formtastic.rb:27:in`':未初始化的常量Formtastic :: SemanticFormBuilder(NameError)

The only thing I can remember what I did last was a bundle install, and since then it hasn't been working. 我唯一记得的是我上次做的是捆绑安装,此后一直没有工作。 I have tried removing and reinstalling my gems, even the formtastic gem. 我尝试删除并重新安装我的宝石,甚至是格式化的宝石。 When I do remove the formtastic gem from my gemfile i get the following error: 当我从我的gemfile中删除格式化的宝石时,出现以下错误:

/config/initializers/formtastic.rb:27:in `': uninitialized constant Formtastic (NameError) /config/initializers/formtastic.rb:27:in`':未初始化的常量Formtastic(NameError)

I then went to comment that formtastic.rb to see what is going on, and when I tried to start the server I then got another error, from another one of my files: 然后,我去评论那个formtastic.rb ,看看发生了什么,当我尝试启动服务器时,我又从另一个文件中得到了另一个错误:

/app/api/V1/base_api.rb:11:in inherited': undefined method inherit' for API::V1::ShoppingListAPI:Class (NoMethodError) /app/api/V1/base_api.rb:11:在inherited': undefined method继承'对于API :: V1 :: ShoppingListAPI:Class(NoMethodError)

Whatever I do, another name error comes up. 无论我做什么,都会出现另一个名称错误。 Not sure what is going on and how to debug this. 不知道发生了什么以及如何调试它。 I have tried to search the internet and have found no solutions to this. 我试图搜索互联网,但没有找到解决方案。 Wondering if someone has uncovered the same problem. 想知道是否有人发现了相同的问题。

Nope, that's not the problem. 不,那不是问题。 SemanticFormBuilder has been renamed to FormBuilder as of version 2. 从版本2开始, SemanticFormBuilder已重命名为FormBuilder

If you create formatastic.rb in your initializers you got this error if you don't need that file remove it and run. 如果在初始化程序中创建formatastic.rb在不需要该文件的情况下将其删除并运行,则会出现此错误
The path is: 路径是:

Configuration/Initializers/formtastic.rb

This seems a Gem dependency problem. 这似乎是宝石依赖问题。 When you did "bundle install" you've probably installed another Gem version you used earlier. 当您进行“捆绑安装”时,您可能已经安装了先前使用的另一个Gem版本。

I highly recommend you to use RVM and create Gemsets to avoid and prevent Gem dependency issues: https://rvm.io/ 我强烈建议您使用RVM并创建Gemsets以避免和防止Gem依赖问题: https ://rvm.io/

Also you may want to check out your Gemfile and Gemfile.lock to see how they works (checkout Railscasts for more info). 另外,您可能想查看Gemfile和Gemfile.lock来查看它们的工作方式(请查看Railscasts了解更多信息)。 I think removing that Gem is not a really good idea, probably better if you reinstall it. 我认为删除该Gem并不是一个好主意,如果重新安装它可能会更好。 Also removing that file isn't really helpful. 此外,删除该文件并没有真正的帮助。 Try to solve this with RVM and installing right gems and you'll be good to go. 尝试使用RVM解决此问题并安装正确的gems,您将一路顺风。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 启动Rails服务器时未初始化的常量版本(NameError) - Uninitialized constant Version (NameError) when starting Rails server 未初始化的常量Rails :: Server(NameError) - uninitialized constant Rails::Server (NameError) Rails - NameError - 未初始化的常量 - Rails - NameError - uninitialized constant Rails:NameError:未初始化的常量 - Rails: NameError: uninitialized constant 启动Rails服务器时未初始化的常量Resque :: Helpers - uninitialized constant Resque::Helpers when starting rails server `block in load_missing_constant':启动 Rails 服务器和控制台时未初始化的常量 Pry::Command::ExitAll (NameError) - `block in load_missing_constant': uninitialized constant Pry::Command::ExitAll (NameError) when launching rails server and console Rails服务器 - 未初始化的常量Sprockets :: Rails :: VERSION(NameError) - Rails Server - uninitialized constant Sprockets::Rails::VERSION (NameError) 错误//未初始化的常量Sass :: Rails :: Application(NameError)] //运行'rails server'时 - Error // uninitialized constant Sass::Rails::Application (NameError)] // when running 'rails server' Rails:NameError:未初始化的常量贷款 - Rails: NameError: uninitialized constant Loans Rails:NameError(未初始化的常量 UserSerializer) - Rails: NameError (uninitialized constant UserSerializer)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM