在Amazon EC2中设置Ruby on Rails

时间:2023-01-26 13:05:27

Ok, so I am trying to set up Rails 3.2.13 on a amazon ec2 instance. I can get rails installed but anything after that will not run. I run rails new "project name" and then cd into the project folder I try to run the following command.

好的,所以我试图在亚马逊ec2实例上设置Rails 3.2.13。我可以安装rails,但之后的任何东西都不会运行。我运行rails new“project name”然后cd进入项目文件夹我尝试运行以下命令。

rails generate scaffold Product title:string description:text image_url:string price:decimal

rails generate scaffold产品名称:字符串描述:text image_url:string price:decimal

I get the following errors.

我收到以下错误。

rails generate scaffold Product title:string description:text image_url:string price:decimal
/usr/local/share/gems/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
    from /usr/local/share/gems/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `rescue in <top (required)>'
    from /usr/local/share/gems/gems/sqlite3-1.3.7/lib/sqlite3.rb:2:in `<top (required)>'
    from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/ec2-user/depot/config/application.rb:7:in `<top (required)>'
    from /usr/local/share/gems/gems/railties-3.2.13/lib/rails/commands.rb:24:in `require'
    from /usr/local/share/gems/gems/railties-3.2.13/lib/rails/commands.rb:24:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

I've tried doing the following but I still see the same error no matter what I do.

我尝试过以下操作,但无论我做什么,我仍然会看到相同的错误。

gem install sqlite3 -- --with-sqlite3-dir=/sw

gem install sqlite3-ruby -- --with-sqlite-dir=/sw

yum install sqlite-devel

bundle install --without assets

bundle install 

I have tried every combination of installing, uninstalling, everything. I have googled but so far nothing has worked.

我已经尝试了安装,卸载,一切的所有组合。我用谷歌搜索,但到目前为止没有任何工作。

Even if I run a simple rake command I get the same error (well almost similar).

即使我运行一个简单的rake命令,我也会得到相同的错误(几乎相似)。

rake db:create
rake aborted!
cannot load such file -- sqlite3/sqlite3_native
/home/ec2-user/depot/config/application.rb:7:in `<top (required)>'
/home/ec2-user/depot/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)

If i run it with --trace its the same error as above.

如果我用--trace运行它与上面相同的错误。

My system is currently running,

我的系统目前正在运行,

ruby -v ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]

ruby -v ruby​​ 1.9.3p286(2012-10-12修订版37165)[x86_64-linux]

gem -v 1.8.23

宝石-v 1.8.23

rails -v Rails 3.2.13

rails -v Rails 3.2.13

x86_64 GNU/Linux

x86_64 GNU / Linux

If anyone can help me get started with this I would appreciate it. Not sure if this is a programming question so if its in the wrong area sorry. Point me in the right direction and I will ask it elsewhere. Thanks in advance for any help.

如果有人能帮助我开始这个我会很感激。不确定这是否是一个编程问题,所以如果它在错误的区域抱歉。指出我正确的方向,我会在其他地方问它。在此先感谢您的帮助。

1 个解决方案

#1


0  

You can use https://github.com/vaneyckt/Ruby-on-Rails-installation-script/blob/master/install.sh.

您可以使用https://github.com/vaneyckt/Ruby-on-Rails-installation-script/blob/master/install.sh。

Just modify where required.

只需修改需要的地方。

#1


0  

You can use https://github.com/vaneyckt/Ruby-on-Rails-installation-script/blob/master/install.sh.

您可以使用https://github.com/vaneyckt/Ruby-on-Rails-installation-script/blob/master/install.sh。

Just modify where required.

只需修改需要的地方。