I am trying to run the rails server on windows instance (I am using gitbash). I already install ruby (1.9.3), rails(4.2.0) and gem (1.8.29). I have took a screen shots of my error and my Gemfiles so you guys can look at it. I dig into the error and it seems like PTY files which are required on the slave.rb files is not supported on the windows! Does anyone know the way around this problem?
Thanks!
To solve this for the time being comment out the web-console gem as this has reference to the pty gem but please take note of my comment on your question
# gem 'web-console'
You might then want to run bundle install again
Related
So, I have no Ruby experience at all. However, I'm being asked to look after some Ruby on Rails / Ruby source code that was left behind by my predecessor. I'd like to at least get it to install and run within its Docker container.
From what I can tell, it is failing because of the mimemagic problem from a couple of years ago. It has a dependency on mimemagic v0.3.0 . I know the right thing to do would be to move on to the recent versions that have not been yanked. But, with my limited experience with Ruby, I'd like to at least get my predecessor's code to install and run.
Since moving up to the earliest mimemagic that is available (v0.3.7) appears to break other things, I have been trying to install v0.3.0 using the GitHub reference as a work around.
This:
gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: 'a4b038c6c1b9d76dac33d5711d28aaa9b4c42c66'
complains that I'm transmitting without encryption. It ultimately fails to fetch with a connection time out.
Meanwhile, this:
gem 'mimemagic', git: 'git#github.com:mimemagicrb/mimemagic.git', ref: 'a4b038c6c1b9d76dac33d5711d28aaa9b4c42c66'
complains that the host key verification has failed.
Finally, this gets me a little further:
gem 'mimemagic', git: 'https://github.com/mimemagicrb/mimemagic.git', ref: 'a4b038c6c1b9d76dac33d5711d28aaa9b4c42c66'
but an error later on looks like this:
rake aborted!
Bundler::GitError: The git source https://github.com/mimemagicrb/mimemagic.git is not yet checked out. Please run `bundle install` before trying to start your application
I have this feeling that "quickly getting it to work" isn't a reality and perhaps all of this will take a lot more than the 1-2 days I've spent so far. I just would like to check what the correct gem/git commands are, and if any of the above three are close.
Thank you!
As the error suggests, you must run the bundle install command before starting the application server or accessing the console.
The reference in the Gemfile is added correctly.
gem 'mimemagic', git: 'https://github.com/mimemagicrb/mimemagic.git', ref: 'a4b038c6c1b9d76dac33d5711d28aaa9b4c42c66'
If you've already executed the mentioned command, can you update the question to have the output for this command?
P.S. Read more about the bundle install command here.
I'm trying to create my first rails app. I'm on a Macbook Pro, so macOS.
I've been following this guide setting up rbenv, rails etc.
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-macos
Then I'm following a crash course on YouTube. In the terminal I try to create a new rails app
rails new foodlog
It starts to set up in the folder I made for it, but the following happens during setup
Bundler::PermissionError: There was an error whle trying to create
'/Users/myusername/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/racc-1.6.0'.
It is likely that you need to grand executable permissions for all parent directories and write permissions for
/Users/myusername/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0'
This error continues repeating the same thing with things such as "strscan".
Then after it says
In gemfile:
rails was resolved to 7.0.3.1, which depends on
actionmailbox was resolved to 7.0.3.1, which depends on
net-imp was resolved to 0.2.3, which depends on
stscan
run bundle binstubs bundler
Could not find gem 'sprockets-rails' in locally installed gems.
rails importmap:install
Could not find gem 'sprockets-rails' in locally installed gems.
Run 'bundle install' to install missing gems.
rails turbo:install stimulus:install
Could not find gem 'sprockets-rails' in locally installed gems.
Run 'bundle install' to install missing gems
I've tried looking online, coming across similar but not exact issues. For example, one solution suggested doing bundle install in this directory, versus where the guide says do it in the home directory. So I do that and get
Bundle complete! 0 gemfile dependencies, 1 gem now installed.
Still doesn't do anything. I think the main culprit is the permissions error it mentions above? This is my first time trying to really do any development on the macOS and I'm sure there's just a misunderstanding somewhere regarding permissions, so if anyone can help that would be appreciated!
It is likely that you need to grand executable permissions for all parent directories and write permissions for
/Users/myusername/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0'
Your question does not mention, so I think you might have missed this suggestion. Make sure all directories have the executable permission
C:\sites\srhapp>rails generate controller home index
C:/Ruby21/lib/ruby/gems/2.1.0/gems/execjs-2.5.2/lib/execjs/runtimes.rb:48:in `au
todetect': Could not find a JavaScript runtime. See https://github.com/rails/exe
cjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
This are the error messages i get. kindly help me out .
Install nodejs. That may help here.
Follow this.
Now that you have Nodejs installed, see if any of these can help with the error you are getting (I was going to comment on jon snow's answer, but my suggestions became too long.):
Make sure you have C:\Windows\System32 in your system's PATH variable.
Close and then restart your command console.
Type node -v into the console. Does Nodejs respond?
Change the therubyracer line in your Gemfile to gem 'therubyracer', {:platforms => [:ruby]}. As far as I know, therubyracer isn't for Windows, but declaring it this way lets it still be used in Heroku if you plan on using that later. Run bundle install after you make this change.
Edit
Do you necessarily need Puma in your Windows development environment? If you only need it for deployment on Heroku, the easiest way that I have found to get around its difficulty with Windows is by putting it into the production group along with any other gems Heroku requires.
Gemfile
...
group( :production ) do
# Serves static assets in Heroku deployment.
gem 'rails_12factor'
# Web server for use with Heroku.
gem 'puma'
# Database used by Heroku.
gem 'pg'
end
...
That way, you can simply exclude those gems when you bundle install in your local development environment.
$ bundle install --without production
If you really do need Puma on a Windows environment, you will have to install OpenSSL libraries and headers (so I have heard; I haven't tried it myself). The comment by luislavena on this page should help you in that case.
I am super, super new at programming and I have been trying to get everything set-up on my computer. I have installed RailsInstaller, go to >railsinstaller_demo, and type in rails s. I get the following error though could not find gem 'uglifier <>= 1.0.3> x86-mingw32'
I looked through the forum and found how to do a gem list and i noticed it was not there. I then went to gembundler and ran $ gem install bundler. I tried again but it did not work.
I am sure the answer is on this site, but i am so new that i see all these lines of code I actually have no idea where to type it in.. I am running Windows 7.
thanks for taking the time to help out a real beginner.
Have you gone to the $ railsinstaller_demo directory and run the bundle install command? This will install the gem dependencies for the application; you will not be able to run the server until you've bundled the gems. Additionally, if you're still having issues with the uglifier gem, go ahead and remove the line in the Gemfile and then run bundle install
If you need further help with the Command Prompt, you an find out more at http://bit.ly/ZajVeW.
Thanks,
Evan
I've added added the gem simple-navigation 3.9.0 to my gemfile in rails 3.2.11 and it runs fine in development. However, when I deploy to my production server and try to open a page with the method I get the following error:
undefined method `render_navigation'
I don't believe it's specific to that one gem though, as I had the same problem earlier when I used the uuid gem.
Using $LOADED_FEATURES I find "simple_navigation", so it seems to be loaded.
Info about the production server
nginx 1.2.6
Unicorn 4.5.0
Rubygems 1.8.23
Ubuntu 12.04 LTS
rbenv 0.4.0-9-g045f6c1
EDIT
Other gems work, the server runs fine, except for the above problem.
Make sure your gem is not declared inside the development group in the Gemfile
The gems in the development group are not be loaded in production.
group :development do
gem "simple-navigation"
end
Also, if you have a <APP_HOME>/.bundle/config file, ensure that it doesn't have the BUNDLE_WITHOUT option.
Gemfile
group :ui do
gem "simple-navigation"
end
.bundle/config
---
BUNDLE_WITHOUT: ui
In the above example, the gem group ui will not be loaded.
Having said that I had very-very limited exposure to Rails, I saw similar behavior when Gemfile.lock wasn't committed into repository. As result when project was pushed to production envinronment there was some screw ups with dependency resolution.
Have you try RAILS_ENV=production bundle install ?
While technically not an answer, I decided to switch over to Linode as my host. This involved a complete re-install of my server setup and it's working now. I did the exact same steps installing the server this time as last, so I'm still not sure what was wrong, or if it would have been easily fixable. Since I no longer have the old server available it would be impossible to confirm any solutions proposed from now on.
I'm going to mark this answer as the solution unless there are any objections within the next 48 hours.