创建新应用程序时 RVM 和 Rails 出现问题

创建新应用程序时 RVM 和 Rails 出现问题

当尝试rails new myapp在以下路径下执行时:/home/novito/Projectes我收到以下错误:

Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.
Type 'rails' for help.

我想象我可能在主文件夹中创建或复制了一个 Rails 应用程序,所以我去了那里,这是我执行时所列出的内容ls -la

drwxr-xr-x  2 novito novito   4096 2012-01-07 18:33 Audiobooks
-rw-r--r--  1 novito novito 604710 2011-06-17 15:54 brasero-session.log
drwxr-xr-x  7 root   root     4096 2011-11-26 23:52 build
drwxr-xr-x  5 novito novito   4096 2011-07-26 19:35 bumblebee
d    rwxr-xr-x  6 novito novito   4096 2012-02-15 06:23 config
-rw-r--r--  1 novito novito    157 2012-01-30 21:17 config.ru
drwxr-xr-x 19 novito novito   4096 2012-02-15 00:32 Desktop
-rwxr-xr-x  1 novito novito    409 2011-09-18 11:29 django.fcgi
drwxr-xr-x  9 novito novito   4096 2012-02-09 18:35 Documents
drwxr-xr-x  2 novito novito  16384 2012-02-14 03:11 Downloads
drwx------ 10 novito novito   4096 2012-02-13 20:12 Dropbox
-rw-r--r--  1 novito novito    179 2011-06-15 13:39 examples.desktop
drwxr-xr-x  2 novito novito   4096 2012-01-30 21:41 gmate
drwxr-xr-x  4 novito novito   4096 2011-06-30 11:09 Music
drwxr-xr-x 17 novito novito   4096 2011-08-21 10:27 Música
drwxr-xr-x 10 novito novito   4096 2011-11-01 10:30 netbeans-7.0.1
drwxr-xr-x  3 novito novito   4096 2011-11-01 10:32 NetBeansProjects
drwxr-xr-x  6 novito novito   4096 2011-11-20 16:18 opt
drwxr-xr-x  5 novito novito   4096 2012-01-16 01:57 Pictures
drwxr-xr-x 27 novito novito   4096 2012-02-15 06:07 Projectes
drwxr-xr-x  2 novito novito   4096 2011-06-15 11:59 Public
-rw-r--r--  1 novito novito   9208 2012-01-30 21:17 README
drwxr-xr-x  2 novito novito   4096 2011-12-25 09:49 Schemes
drwxr-xr-x  2 novito novito   4096 2012-01-30 21:17 script
drwxr-xr-x  3 novito novito   4096 2011-06-16 23:24 Software
drwxr-xr-x  2 novito novito   4096 2011-06-15 11:59 Templates
drwxr-xr-x  8 novito novito   4096 2012-01-30 21:17 test
drwxr-xr-x  2 novito novito   4096 2012-02-10 20:24 TESTRAILS
drwxr-xr-x  6 novito novito   4096 2012-01-31 00:41 tmp
drwxrwxr-x  2 novito novito   4096 2011-06-15 11:56 Ubuntu One
drwxr-xr-x  4 novito novito   4096 2012-01-30 21:17 vendor
drwxr-xr-x  4 novito novito   4096 2012-01-14 16:02 Videos
drwxr-xr-x  2 novito novito   4096 2012-01-07 18:33 Vídeos
drwxr-xr-x  6 novito novito   4096 2011-11-10 22:55 workspace

因此,我尝试删除配置和供应商,因为它们是其他 rails 应用程序相关的文件夹...但是当我删除配置时,如果我尝试执行 rails new,我会收到此错误:

<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- /home/novito/config/boot (LoadError)
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from script/rails:5:in `<main>'

我真的不知道这里发生了什么,如果有人能提供任何提示,我将不胜感激。

答案1

该问题可以转移到www.stackoverflow.com

您可能在 /home/novito/Projectes/ 文件夹中还有另一个 rails 应用程序。

检查这里的答案(我不知道是否相关):https://stackoverflow.com/questions/3865515/strange-inability-to-require-config-boot-after-upgrading-to-ruby-1-9-2

我没有使用 ruby​​/rails,但是如果上述方法不起作用,我认为您需要重新安装使用 rvm 下载的 ruby​​ 版本:http://beginrescueend.com/

rvm implode
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
rvm requirements # Find the requirements (follow the instructions)
rvm install 1.9.3 # Change 1.9.3 with your version

有关 rvm 的更多信息(请查看“基础知识”):http://beginrescueend.com/rvm/

然后重试:

reset
mkdir -p /home/novito/Projectes/mynewrailapp
which ruby #check you are using the correct version of ruby
which rails #check you are using the correct version of rails
rails new myapp /home/novito/Projectes/mynewrailapp

相关内容