Getting this error even when I create a new project. I installed Ruby and RoR through RVM
cannot load such file -- /var/lib/gems/2.3.0/gems/passenger-5.0.30/src/ruby_supportlib/phusion_passenger (LoadError)
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/var/lib/gems/2.3.0/gems/passenger-5.0.30/src/helper-scripts/rack-preloader.rb:74:in `init_passenger'
/var/lib/gems/2.3.0/gems/passenger-5.0.30/src/helper-scripts/rack-preloader.rb:155:in `<module:App>'
/var/lib/gems/2.3.0/gems/passenger-5.0.30/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/var/lib/gems/2.3.0/gems/passenger-5.0.30/src/helper-scripts/rack-preloader.rb:29:in `<main>'
I think I found that the problem is in the directory of the gems. I do not know how to change it on Ubuntu
I would first try to understand if you have a problem with the app or the environment.
Try to run the simplest app by:
rails new simple_app
if it doesn't work - the problem is the environment.
if it does work - probably you have some problem with the initializers or config files
Let us know how it works for you!
Have you try gem install passenger ?
or gem install bundler
Your error message:
cannot load such file -- /var/lib/gems/2.3.0/gems/passenger-5.0.30/src/ruby_supportlib/phusion_passenger (LoadError)
Suggests a permission problem with files in the gem /var/lib/gems/2.3.0/gems/passenger-5.0.30. Either, the files don't exist, or they aren't readable.
If you query the permissions for that file (make sure to append '.rb'):
ls -l /var/lib/gems/2.3.0/gems/passenger-5.0.30/src/ruby_supportlib/phusion_passenger.rb
You'll probably find it's not world readable, or at least not readable by the web server process' user. If it doesn't exist, then you should reinstall.
I saw this error on a system that had a umask of 0066, which caused passenger's gem files to be root:root with mode -rw-------.
Related
I am setting up a machine running:
ruby 3.0.4-p208
passenger 6.0.14
redmine 5.0.1.stable
redmineUP latest version of all plugins
mysql2 5.7
I'm trying to install redmineX, which theoretically plays well and requires redmineUP. RedmineUP is installed and is more-or-less running. I'm having an error during the install:
bundle exec rake redmine:plugins:migrate RAILS_ENV=redmine_test
fails with the error:
cannot load such file -- redmine_x_ux_upgrade/view_projects_hook (LoadError)
/home/test_user/.gem/ruby/3.0.4/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
/home/test_user/.gem/ruby/3.0.4/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
/home/test_user/.gem/ruby/3.0.4/gems/activesupport-6.1.6/lib/active_support/dependencies/zeitwerk_integration.rb:51:in `require_dependency'
/home/test_user/redmine-5.0.1/plugins/000_redmine_x_ux_upgrade/init.rb:22:in `<top (required)>'
/home/test_user/redmine-5.0.1/lib/redmine/plugin_loader.rb:31:in `load'
- GEM PATHS:
- /home/test_user/.gem/ruby/3.0.4
- /opt/rubies/ruby-3.0.4/lib/ruby/gems/3.0.0
The file in question exists:
/home/test_user/redmine_test/plugins/000_redmine_x_ux_upgrade/lib/redmine_x_ux_upgrade/view_projects_hook.rb
Ideas?
Since this is occurring at the bundle exec rake, rather than in the redmine app, I'm assuming this issue is with the user GEM_PATH. I've tried tweaking GEM_PATH to also contain
/home/test_user/redmine_test/
/home/test_user/redmine_test/plugins/
with no success.
This turned out to be a versioning problem; using plugins written for redmine 4.x in a redmine-5.x environment.
The main problem was the vendor's helpdesk reformatted email so well-formatted plain-text with blank line separated error and log output ended up all run together. After turning all logs, error output, directory listings, etc. into separate files and attaching them, they could read the main part of the mail and identify the problem.
I'm on Windows 10 and am a complete beginner programmer. I am using Ruby 2.4.2, Rails 5.1.4 and am following a Lynda course on how to run Rails 5 on Windows.
There's a part near the end where the tutor says to enter:
>rails db:schema:dump
to test whether you've established a connection to the MySQL by create a file inside the created project.
This is what I get when I enter the above command:
C:\Users\notmyactualuser\Documents\Sites\demo_project>rails db:schema:dump
rails aborted!
LoadError: cannot load such file -- mysql2/2.4/mysql2
C:/Users/notmyactualuser/Documents/Sites/demo_project/config/application.rb:7:in `<top (required)>'
C:/Users/notmyactualuser/Documents/Sites/demo_project/Rakefile:4:in `require_relative'
C:/Users/notmyactualuser/Documents/Sites/demo_project/Rakefile:4:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)
The tutor doesn't address what to do with potential errors and I can't seem to find an answer. I want to build a login form using RoR and am trying to grasp the basics (clearly failing). If possible, can I get help with the above and be directed to an easy, simple, "how-to" on building a login form?
Thanks a lot.
P.S. My first post, so please go easy on me, lol.
UPDATE: So I used the command on CMD and it looks like it's successful. Can somebody point me to how to get it working with Rails?
UPDATE 2: I put in the command that Hoa requested and I got this:
ERROR: "bundle install" was called with arguments ["mysql2"]
Usage: "bundle install [OPTIONS]"
UPDATE 3: I did as Satishkakumar said and I got this:
You've installed the binary version of mysql2.
It was built using MySQL Connector/C version 6.1.6.
It's recommended to use the exact same version to avoid potential issues.
At the time of building this gem, the necessary DLL files were retrieved from:
http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-6.1.6-win32.zip
This gem includes vendor/libmysql.dll with redistribution notice in vendor/README.
======================================================================================================
Looks like it's all sorted now? Please let me know if there's any more.
I think its issue of installing mysql2 gem in system. Follow below steps to install.
In Gemfile add the line
gem 'mysql2', '0.3.21'
And run bundle install from project folder in CMD.
bundle install mysql2
This might solve your issue. Let me know in comment section if your issue still persists.
Versions, dependencies, and other information:
Ruby: 1.9.3p392 (2013-02-22) [i386-mingw32]
Rails: 3.2.13
Gemfile located at: http://pastebin.com/z9u40Jca
For some reason, whenever I run any gem based command, it gives me this error:
$ rails s
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/rubygems.rb:30:in `require': cannot l
oad such file -- rubygems/defaults (LoadError)
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/rubygems.rb:30:in `<top
(required)>'
from <internal:gem_prelude>:1:in `require'
from <internal:gem_prelude>:1:in `<compiled>'
I have tried deleting ruby 2.0.0 from pik and the rails installer folder, because another SO thread said that would fix it. The commands were working as of 5 hours ago, and must have stopped right when I finished using the rails console (part of learning rails from this tutorial, it was just basic math and string manipulation, so I don't think I screwed something up). Any ideas on what I should do?
Try deleting 'ruby '1.9.3' ' from your gem file. It shouldn't be causing a problem, but I've seen situations where it has.
I don't know if I did something I don't know about, but to the best of my knowledge, adding the gem "bootstrap-sass" at version 2.3.2.0 got it working again. I doubt that it was adding that exact gem that was the solution, but you never know.
I'm all of the sudden getting the follow error message when I try to load the rails console. I just recently switched databases to postgres, which has given me a slew of problems (although I must admit I like it a lot better than mysql!), so I'm assuming this is related to that. Any ideas?
y (Errno::ENOENT)/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:251:in `require': No such file or directory - /usr/local/lib/?
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/sprockets-2.2.2/lib/sprockets/processing.rb:3:in `<top (required)>'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/sprockets-2.2.2/lib/sprockets/base.rb:5:in `<top (required)>'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.10/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/sprockets-2.2.2/lib/sprockets/environment.rb:1:in `<top (required)>'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/actionpack-3.2.10/lib/sprockets/railtie.rb:23:in `block in <class:Railtie>'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/initializable.rb:30:in `run'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/initializable.rb:54:in `each'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application.rb:136:in `initialize!'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/benyorke/rubystore/config/environment.rb:6:in `<top (required)>'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application.rb:103:in `require'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/application.rb:103:in `require_environment!'
from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.10/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I believe this might be a bug with Ruby 1.9.3-p327 that just got fixed by Ruby 1.9.3-p385. Does upgrading to 1.9.3-p385 fix it for you?
What seems peculiar in this error message, and is similar to issues I've been having, is the question mark at the end of the path: No such file or directory - /usr/local/lib/?. I've been getting similar strange error messages related to ruby's require and paths with question marks, at symbols, or other random characters at the end of paths after upgrading to 1.9.3-p327 from 1.9.3-p194 a few weeks ago. However, the issues have been extremely sporadic, and around the same time we experienced some hardware failures, so it's been tough to track down.
Today the issue started happening consistently in one specific context, so I was able to do some additional debugging. Updating to 1.9.3-p385 seems to have fixed it, but given the sporadic nature of the issues I've been experiencing, I'm not entirely 100% this is actually the fix. I'm also not entirely sure if this is the same issue you're having. The mysterious question mark in the path just makes it appear like it might be related. Here are a couple examples of the type of errors we were getting:
No such file or directory - /srv/shared/rails/internal/admin/vendor/bun#
No such file or directory - /srv/shared/rails/internal/admin/vendor?
If it's at all related to the same issues I've been experiencing, but the 1.9.3-p385 upgrade doesn't fix it, a few other notes or things to explore:
I was able to reproduce this problem today on 1.9.3-p327 and 1.9.3-p374. However, the problem didn't seem present on 1.9.3-p194, 1.9.3-p286, and 1.9.3-p385.
Are you using symlinks anywhere in in your gem load path? For example, we use Bundler to install gems into a local vendor/bundle path inside each application. But the vendor/bundle is actually a symlink to another location (this is related to a Capistrano deployment setup). I believe the symlink was possibly playing a role. In today's tests, if I wasn't using a symlink, the problem disappeared on all versions of ruby.
Do you use bundler-exec? On another occasion where this problem was happening somewhat sporadically, bypassing the aliases bundler-exec also seemed to magically fix things, but today's problem wasn't even touching bundler-exec, so I'm not too sure.
Most of the time our problem was very random (it would go away after a few attempts of running the same command), but on a few occasions, the problem would persist for an hour or more before disappearing.
Some information about our systems:
64bit RedHat Enterprise Linux 6
Bundler 1.2.3
Rubygems 1.2.5 (also happened under 1.2.4)
rbenv
But like I said, this issue also happened to coincide with some hardware disk failures and general server wonkiness on our end, so I haven't really been certain if this was a Ruby issue or what's been going on. But here's to hoping 1.9.3-p385 actually fixes it.
Sorry for not updating this thread - I have actually been working on this in the background for a few weeks now. I couldn't find ANY information on this online, so I'm going to post as detailed of a solution as I can.
The Issues
The issues I was having was that I could not access rails console, and I had to manually start the postgres server every-time I restarted my machine. My solutions to that, as I have worked with this for a few weeks were
In regards to the console I used herokus console. By pushing my app to heroku (which is free) not only could I view it on the web (any machine) but on my machine I could run
$ heroku run console
and get access to a console. Now this isn't a perfect solution in anyway as I can't manipulate data on my machine but it saved me many times
In regards to the server I ran
$ brew info postgres
which gave me the commands to manually restart the server
You should reload postgresql:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
The Solution
To be honest, I have run every command I can find dozens of times, and just today got it working. I don't know if I was making typos, doing it in an ineffective order, mixing up pg/postgres/postgresql or what but what I did below worked
When using this solution, it will erase all databases. Migrations will be able to rebuild the structure, but any data will be lost
1. Updated Homebrew
$ brew update
If you don't have home-brew, check out this page for instructions to install (saved my neck with many things, including minimagick imagemagick and postgres!): Link
2. Removed postgresql
$ brew rm postgresql --force
3. Installed postgreql
$ brew install postgresql
This is the first step to reference postgres. When looking online, I ran across commands that used postgresql, postgres, and pg. Postgresql refers to the actually PostgreSQL program. postgres and pg are ruby gems, which we will get to later
4. Ran suggested commands
After running "$ brew install postgres" there is a lot of information given to you. Make sure to read through it, as it will suggest what commands to run. Use these suggestions to find the commands I reference below.
If you need to access this information later simply run
$ brew info postgresql
To initialize the database
$ initdb file/path
Set up the autolauncher
$ cp file/path ~ LaunchAgents/file/path
Launch postgresql initially
$ launchctl load file/path
$ pg_ctl-D file/oath
5. Download Postgres.app
Although to my knowledge this seems redundant, this is what got it to work on my mac. visit http://postgresapp.com to download
6. Install gems
There are two gems - postgres and pg. I required pg in my gemfile and ran a bundle install command, however it still gave me issues until I installed postgres on my machine - even though it is not required in my gemfile, rails console wont seem to work without it atleast installed
In the gem file
gem 'pg'
Run a bundle install command in a terminal window
$ bundle install
Sudo install the postgres gem
$ sudo gem install postgres
At this point everything should be working. You should be able to restart the machine and not have any problems!
Thanks for taking a look at this.
I started a beginner's tutorial on RoR through lynda.com. I followed the instructions to the letter. Everything was working so far until I got to accessing Webrick. When I typed in "rails server" to begin work, I got this error message below.
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle
from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2.rb:8
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler.rb:120:in `require'
from /Users/macuser/Sites/simplecms/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:28:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:28
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:27:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.6/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6
I'm using a
iMac
Ruby 1.87
Gem 1.7.2
Since I'm not experienced with anything Ruby, I'm lost on how to fix this.
Thanks in advance for your attention and help if possible.
Run these at the terminal:
gem install bundler
bundle
And then you should be able to boot the server.
Edit: You should really look into using rvm to manage your ruby installs and gemsets. It'll save you a lot of time and effort in installing them too.
I ran into the same problem as you (also attempting to go through the Lynda course), and also being a newbie I got pretty frustrated pretty quickly.
Buuuuut, after some searching, I found and answer here I got it to work.
First, I installed the 32-bit version of MySQL, as opposed to the 64-bit version, but I'm not sure if that made a difference.
Then, uninstall the Mysql gem
gem uninstall mysql2
then reinstall it
sudo gem install mysql2
and finally
sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle
and you should be good to go! Worked for me anyways. good luck!
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
This is the code that worked for me :D
I had the same problem. I simply ran the following code:
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib
Press enter, and then run
rails server
and it worked!
Correct way that worked for me was:
cd ~ [command]
nano .bash_profile [command]
add this line of code:
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"
ctrl+x [save]
y [yes]
cd Sites/sitename/ [command]
rails server [run WEBrick server]
and you should get this message:
=> Booting WEBrick
=> Rails 3.2.11 application starting in development on localhost:3000
=> Call with -d to detach