Gem uninitialized constant Grape (NameError)

tomwey · June 05, 2013 · Last by tomwey replied at June 06, 2013 · 2984 hits

使用 Grape 在本地测试完全正常,但是部署到服务器上,启动报如下错误: uninitialized constant Grape (NameError)

是怎么回事呢?求解

Gemfile 里面 grape 是不是在 development 的 group 里面了,像下面这样,如果是,那就把它移出去,重新 bundle install 就好了

group :development
   gem 'grape'
end

@huacnlee 不在 development 的 group 里面啊,直接写到外面的,然后我参考 Ruby China 的代码,用你那个版本的 gem, bundle 直接报错啊。然后就用了 gem 'grape' 和 gem 'grape-entity' 。 然后部署到 production 下,直接就启动不了,报错啊!!!

沒用bundle exec?

@yesmeck 呃,我是用的 rbenv 部署的

然后 gem 会自动安装吧,而且我找到了 grape。

You need to Sign in before reply, if you don't have an account, please Sign up first.