Can not create rails apps anymore under Ubuntu - ruby-on-rails

I have a problem with all my three! Ubuntu systems. I can't create any Rails projects anymore with the following command
rails new abcde
I get the following error message.
Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first
I know the error message is really clear, I googled and checked all the entries here on StackOverflow. No one had another explanation other than there is a project in a parent folder, which is not the case in my systems!
I checked all folders back to root for any hidden files resembling a rails project. Nothing! I even created a new folder under root /projects and tried to create a project in there, same error. I don't know what to do anymore, I have the same problem on all three of my Ubuntu computers. Has anyone ever had this problem and could fix it? What could be another cause of this. Because there is no project in any of parent folders.
The only possible solution for me is, that there is maybe a PATH variable for Rails that I don't know about and there is maybe a project in there?

SUGGESTIONS:
0) I'm assuming you're typing these commands from a console window, and not executing a shell script, shortcut, or "something else". Correct?
1) Please update your post with the following: ruby -v; rails -v (Ruby and Rails version info)
2) Please try another test project, and copy/paste any error or warning messages you see:
cd /tmp
rails new abc -f
<= another test "rails new", with "--force" option
3) Assuming you've installed RVM, and assuming your "rails new" is calling "run bundle install", then also make sure your user is a member of the "rvm" group:
sudo usermod -G rvm -a MYUSER
4) If you haven't already, please also look at these links:
can't initialize a new rails application within the directory of another
Problems with RVM and Rails when creating new app

Related

Rails environment broke- need help repairing

ugh! In the course of working in my perfectly good rails environment, I did something bad:
While running my local sandbox, looking in Chrome developer tools/sources (this is for our own codebase), I clicked an item in the sources list and doing so prompted downloading a file: Roboto-Regular-e60d1ba1cef90e4a4da5c9e2fe1ec3b1.woff2
I got a "threat detected" popup
I submitted the screen I was on, and saw an error to the effect of 'no data', and rails server had stopped
Now I'm having the following symptoms:
Typing "rails server" (or even just "rails") gives me a "No such file or directory" error for /usr/local/Cellar/rbenv/1.1.1/libexec/rbenv.
the following script (with no modifications since its original create date last year) has the line looking for that file : /.rbenv/shims/rails
in the directory in question (libexec), I don't see a plain "rbenv" file, only these with more specific names: rbenv---version, rbenv-help, rbenv-realpath.dylib, rbenv-version, rbenv-version-origin, rbenv-commands, rbenv-hooks, rbenv-root, rbenv-version-file, rbenv-versions, rbenv-completions, rbenv-init, rbenv-sh-rehash, rbenv-version-file-read, rbenv-whence, rbenv-exec, rbenv-local, rbenv-sh-shell, rbenv-version-file-write, rbenv-which rbenv-global, rbenv-prefix, rbenv-shims, rbenv-version-name
I've just used homebrew to upgrade rbenv, but the symptom is still the same.
My $PATH variable has:
-bash: /Users/drkaplan/.rvm/gems/ruby-2.2.2/bin:/Users/drkaplan/.rvm/gems/ruby-2.2.2#global/bin:/Users/drkaplan/.rvm/rubies/ruby-2.2.2/bin:/Users/drkaplan/.rvm/bin:/Users/drkaplan/.nvm/versions/node/v6.11.2/bin:/Users/drkaplan/google-cloud-sdk/bin:/Users/drkaplan/.rbenv/shims:/Users/drkaplan/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Applications/Postgres.app/Contents/Versions/latest/bin: No such file or directory
Ideas for where to look next?
The solution in this case was to reinstall rails:
gem install rails

Previous Ruby on Rails application in Cloud9 running on server

I'm new to Ruby on Rails and working through some tutorials, using Cloud9 as an IDE. I recently switched to making a second app only to find that the first one runs on the server available for preview. I have tried starting the new app with $ rails server -b $IP -p $PORT. I have tried stopping the server on the first app with Ctrl + C in the command box. None of this is doing anything. The first application is the only one that displays.
Can someone please explain what is going on? How do I associate the base URL in Preview with the one set in the routing of my new application and why isn't this being done automatically?
Okay, I think the following will work on C9. But personally, I still think separate workspaces would work best.
Create a new project in C9, this will create a new workspace for you. While the folder tree will display the name of your project, the terminal will display ~/workspace. The two are synonymous (for now). This will be your first rails project.
To create a second project within the same C9 space, do the following:
In terminal, cd .. to go up one level. This should take you to the root ~ directory.
Type rails new <name-of-second-project> to create a new project.
At the top of the folder tree, click on the gear wheel. Unselect Show Root File System and Select Show Home in Favorites.
If you look at your folder tree now, you should see both of your rails projects. The first is listed as workspace and the second is whatever you named your second project.
If you want to rename workspace to match the actual name of your project, mv workspace <name-of-first-project>.
That's pretty much it. You can now navigate into each folder and treat it as a separate rails project. When using rails s -b $IP -p $PORT in the terminal, just make sure you're in the correct directory, depending on which project you want to run the server for and it'll work.

Creating a Rails app in workspace directory of Cloud9 IDE

When I run rails new . hoping to create a new Rails app in my workspace directory, rails says:
Invalid application name 567101. Please give a name that does not start with numbers.
How do I get around this? I could just create it within the top level directory, but that seems inelegant. When you create a workspace and select "Rails" for the type it sets up the app nicely in the right place, but I want to set up a Rails 4 app, so that's not an option.
I was just trying to figure this out myself. What I ended up doing is creating a symbolic link to the numbered directory named rails_app. I was then able to do a rails new and have it create the application.
First
cd ~/
Then
ln -s ./567101 ./rails_app
Then
rails new ./rails_app

Can't start a new rails app

When I try to start a new rails app, I get this notification:
"Can't initialize a new Rails application within the directory of another, please Type 'rails' for help."
I read that I may have to empty some directory because there may already be another rails app created. I'm not sure how to do this and start over.
cd ~
cd ProjectsDir # <= Wherever you save your projects
rails new project
cd project
rails generate ...
typing cd .. means going backwards in the directory you're in ...
for example, you're in this_directory, and it's on desktop ...
so, typing cd .. while in this_directory means that you're back on desktop directory now ...
as for the current directory that you're in, don't worry about it ...
just go backwards, and when outside of it, you can delete that directory as you wish, or leave it alone.
type "rails new name_of_app" to start a new rails project ...
and of course, type cd name_of_app to go into the directory of your new rails project.
let us know if you need further clarification ...
cd ../
rails new i_am_in_new_directory

"Can't initialize a new Rails application within the directory of another, please Type 'rails' for help."

I'm just starting out with rails and I'm practicing the basic ruby commands, one of which is the rails new myproject command.
My projects are under the Aptana workspace directory where I've used the command line and Aptana both to create projects there. After a few creations and rails s commands and deletions, I've started getting this error message when I try to generate a new rails project:
"Can't initialize a new Rails application within the directory of
another, please Type 'rails' for help."
This doesn't just happen when I create a new project (rails new myproject) under the Aptana workspace directory, but also when I use the command rails new . directly inside the workspace directory. Can someone explain to me what I need to do to flush rails so it knows I don't have a project there anymore? What did I do to make this happen?
I don't remember what rails looking for. The quickest way to solve this issue is to completely empty the affected directory.
Most likely there are some hidden files or directories which prevents rails from creating a new project. Look at that with ls -a probably there is a .bundle folder inside that dir.
I got same problem since I failed to create rails project. I tried to remove Aptana plug-in and Eclipe that include ./eclipse, ./metadata but not sloved the problem until I removed Ruby and Devkit and reinstall them again.
So, I think the root cause may in Devkit or Ruby. The problem work out after I reinstall Ruby(rubyinstaller-2.2.3-x64.exe) and DevKit(DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe).
If you are under Windows, you must install Aptana Studio as administrator or it will not work properly. Uninstall and install it as administrator and the terminal folder will be set correctly

Resources