I try to generate a controller but it gives me this error. I can't find where in my files what caused this error so help would be much appreciated. I am running Ruby '2.0.0' and rails '4.2.0.beta2' if that helps at all. PLEASE help! Thanks
I don't undestand WHY this post is getting marked as a duplicate. My question has nothing to do with that other question. Plus, I am asking what to do to fix it, and as far as I read, I didn't even see a fix to that error. PLEASE HELP!
c:\Users\NAME\workspace\sample_app>rails generate controller StaticPages home help
DL is deprecated, please use Fiddle
C:/Ruby200/lib/ruby/gems/2.0.0/gems/web-console-2.0.0.beta3/lib/web_console/slave.rb:1:in
`require': cannot load such file -- pty (LoadError)
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/web-console-2.0.0.beta3/lib/web_console/s
lave.rb:1:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/web-console-2.0.0.beta3/lib/web_console.r
b:13:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/web-console-2.0.0.beta3/lib/web_console.r
b:13:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/web-console-2.0.0.beta3/lib/web-console.r
b:1:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/web-console-2.0.0.beta3/lib/web-console.r
b:1:in `<top (required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:76:i
n `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler.rb:133:in `requ
ire'
from c:/Users/Devin Miller/workspace/sample_app/config/application.rb:7:in `<top (
required)>'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta2/lib/rails/commands/c
ommands_tasks.rb:141:in `require'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta2/lib/rails/commands/c
ommands_tasks.rb:141:in `require_application_and_environment!'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta2/lib/rails/commands/c
ommands_tasks.rb:128:in `generate_or_destroy'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta2/lib/rails/commands/c
ommands_tasks.rb:50:in `generate'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta2/lib/rails/commands/c
ommands_tasks.rb:39:in `run_command!'
from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta2/lib/rails/commands.r
b:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
The problems is the Rails 4.2.0.beta depends on the pty gem and is unable to find it:
`require': cannot load such file -- pty
The reason is that the pty gem is not available on Windows. Hopefully that gets fixed before Rails 4.2 is released. At the moment you can fix this problem by removing the web-console gem from your Gemfile:
# Gemfile
# gem 'web-console'
Run bundle install after removing that gem.
To fix the problem that no source of timezone data could be found (TZinfo::DataSourceNotFound) please add the following line to your Gemfile:
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
And then try again:
bundle install
bundle exec rails generate controller StaticPages home help
Related
I am having trouble finding a solution to this issue, and have tried many fixes others have ran into with no success. I am working on the Ruby on Rails 5 Tutorial by Michael Hartl which requires using bcrypt to implement the has_secure_password feature. When I run the test I get a long error message which starts with:
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:in 'require': cannot load such file -- bcrypt_ext (LoadError)
I have attempted uninstalling and reinstalling bcrypt with adding --platform=ruby at the end and including various versions in the gemfile; gem 'bcrypt', '~> 3.1.7', 'bcrypt', '3.1.11', platforms: [:ruby, :x64_mingw], 'bcrypt', '~> 3.1.7', platforms: [:ruby] including various combinations of installing the gem file from the command line. Leaving the gemfile hashed out while installing from the console, uninstalling and running the Bundle Install with just the gemfile link.
This is the entire Error message I am receiving when trying to access the Rails Console:
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:in 'require': cannot load such file -- bcrypt_ext (LoadError)
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:in `rescue in <top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:12:in `<top (required)>'
from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:81:in `require'
from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:81:in `block (2 levels) in require'
from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:76:in `each'
from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:76:in `block in require'
from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:65:in `each'
from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:65:in `require'
from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler.rb:114:in `require'
from C:/Users/Bill/Documents/Sites/sample_app/config/application.rb:7:in `<top (required)>'
from C:/Ruby23x64/lib/ruby/gems/2.3.0/gems/railties-.1.4/lib/rails/command/actions.rb:15:in `require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:96:in `perform'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in`run'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I am using Ruby version 2.3.3 with Rails version 5.1.4 running on Windows 7x64.
Any insight anyone could offer me at this point would be appreciated.
UPDATE
So after countless hours trying to solve the problem, using the gemfile:
gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
was what solved the problem for me. This may not be a permanent solution, but at least it's letting me move forward!
There are more recent solutions you may want to explore, but when I had this problem several months ago with Rails 5.0, I used the accepted answer from this stack overflow question and it worked for me.
Update:
As suggested, I have added full answer in case link becomes dead.
First- Uninstall bcrypt
gem uninstall bcrypt-ruby
Then reinstall
gem install bcrypt --platform=ruby
Then in your Gemfile:
gem 'bcrypt','~>3.1.11' # Or current version
Hey I get the following Error when i try to start the rails server
Any ideas? At the moment no possible solution worked...
By the way I run Windows 8... might be the problem at all :D
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- 1.9/bcry
pt_ext (LoadError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bcrypt-ruby-3.1.0-x86-mingw32/lib/bcrypt_ext.rb:2:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bcrypt-ruby-3.1.0-x86-mingw32/lib/bcrypt.rb:12:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler.rb:132:in `require'
from C:/Users/Enno/RubymineProjects/BookWriting2.0/config/application.rb:13:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:24:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:24:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
This morning, I'm facing the same issue too (Windows 7).
Let me recommend to have a look here
https://github.com/codahale/bcrypt-ruby/issues/72
I successfully fix my problem like this (updating my Gemfile):
gem 'bcrypt-ruby', '3.1.1.rc1', :require => 'bcrypt'
If you have problems with the gem bcrypt, follow these steps:
1. Change to the gem directory found by bundle show bcrypt + ext\mri\, for example: c:\RailsInstaller\Ruby2.2.3\lib\ruby\gems\2.2.0\gems\bcrypt-3.1.10-x86-mingw32\ext\mri
2. run ruby extconf.rb
3. run make
4. make install
Note that this works only if your DevKit environment is correctly setup (run devkitvars.bat).
I encountered a similar issue but with Ruby 2.0 and Rails 3.2.15 on Windows. It now requires at least 3.1.2:
gem 'bcrypt-ruby', '~> 3.1.2'
Link:
https://github.com/rails/rails/pull/12325
Comment off "gem 'bcrypt-ruby', '~> 3.0.0'" in your gemfile
this should be work
The relevant version will constantly change. You can find the newest stable version number here: rubygems.org/gems/bcrypt-ruby
If anyone is still having issues with this (especially with devise) on Windows 64 bit, try installing Ruby 64 bit, then rails as a gem (rather than using the rails installer) and then add:
gem 'bcrypt-ruby', '~> 3.0.0', :require => "bcrypt"
You may need to change your tzinfo-data gem to:
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
I am using Rails 3.2.9 with ruby 1.9.3 (made default using RVM). From the root directory of my test_app when I executed the command 'rails console' / 'rails c', the following error is showing.
rails console
/home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327#global/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
from /home/local/rajesh.co/Rajesh/blog/config/application.rb:7:in `<top (required)>'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands.rb:39:in `require'
from /home/local/rajesh.co/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.9/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Can anyone help me to resolve this?
Yes, I got the answer for my question.
Just Open the file 'Gemfile' inside the root directory of your application folder, and then paste the below lines there.
gem 'execjs'
gem 'libv8'
gem 'therubyracer'
After pasting it, just save the file and execute 'bundle update' on the command prompt.
On finishing bundle update successfully, you try running 'rails c' or 'rails console' for taking the rails console. It works!!
Thank you.
Install the folowing both:
gem 'execjs'
gem 'therubyracer'
Try installing
gem 'therubyracer'
Source
I am trying to install the pusher-client gem.
I've put this in my Gemfile:
gem "pusher-client",:git=>"git://github.com/logankoester/pusher-client.git"
bundle install is ok
But when I start the app:
/Users/thomas/.rvm/gems/ruby-1.9.2-p318/gems/bundler-1.2.0/lib/bundler/runtime.rb:76:in `require': no such file to load -- pusher/client (LoadError)
from /Users/thomas/.rvm/gems/ruby-1.9.2-p318/gems/bundler-1.2.0/lib/bundler/runtime.rb:76:in `rescue in block in require'
from /Users/thomas/.rvm/gems/ruby-1.9.2-p318/gems/bundler-1.2.0/lib/bundler/runtime.rb:62:in `block in require'
from /Users/thomas/.rvm/gems/ruby-1.9.2-p318/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `each'
from /Users/thomas/.rvm/gems/ruby-1.9.2-p318/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `require'
from /Users/thomas/.rvm/gems/ruby-1.9.2-p318/gems/bundler-1.2.0/lib/bundler.rb:128:in `require'
from /Users/thomas/Documents/TweetTv/server/tvtweet/config/application.rb:12:in `<top (required)>'
from /Users/thomas/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.0/lib/rails/commands.rb:38:in `require'
from /Users/thomas/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.0/lib/rails/commands.rb:38:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
It seems to be linked to the - in the gem name, but other gem install correctly.
Any help or suggestion greatly appreciate...
Your git path is wrong. If you go to the repository on GitHub you'll see the code has moved to here.
You should do this in your Gemfile instead:
gem 'pusher-client', :git => "git://github.com/pusher/pusher-ruby-client.git"
I tried to run rails/generate paperclip photo data and the following error occured:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/rubygems_integrat
ion.rb:143:in `block in replace_gem': paperclip is not part of the bundle. Add i
t to Gemfile. (Gem::LoadError)
from C:/Ruby192/rubydev/upload/config/environment.rb:6:in `<top (require
d)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.0.rc2/lib/rails/ap
plication.rb:103:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.0.rc2/lib/rails/ap
plication.rb:103:in `require_environment!'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.0.rc2/lib/rails/co
mmands.rb:25:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I am trying to upload and store an image using ruby on rails.
Write gem paperclip, '2.5.0' in your Gemfile. Delete Gemfile.lock and then bundle install or bundle update
From within your application directory, run the following from the command line,
bundle install paperclip