I am new to this so please be lenient if I am not asking in a good way.
I have seen some similar questions such as: Can't start rails server mysql2 gem?
however I have not been able to solve this problem through their answers.
I am trying to start a ruby on rails server, I have installed MySQL, ruby, rails, and the gems successfully. I have also installed the sql2 gem successfully. I have created a project and changed to its directory. When I type:
rails server
to create a server, I get the following message in the terminal:
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in 'require': cannot load such file -- mysql2/2.2/mysql2 (LoadError)
followed by a lot more text but I believe this line is the root of the problem.
This is what is in the mysql2.rb file:
RUBY_VERSION =~ /(\d+.\d+)/
require "mysql2/#{$1}/mysql2"
In the error it says it cannot load mysql2/2.2/mysql2,
when I navigate to the mysql2 folder, there is only a 2.0 and a 2.1 folder, no 2.2 folder. Is this the problem? If so do you know how I fix it?
Change require "mysql2/#{$1}/mysql2" to require "mysql2/2.1/mysql2" in your mysql2.rb file, I think the issue is that it's looking for the version that doesn't exist, give that a try and get back to us if it doesn't work.
Regards,
Grant
Related
I'd like to make sure you pay attention that the error is not in the javascript line, it's in marked at the line containing the stylesheet link tag!
I was following this guide:
http://guides.rubyonrails.org/getting_started.html
I get to part 4.3 Setting the Application Home Page
I've done everything up to this point, used the generate command to make a new controller and a view named "Welcome".
I've changed the app/views/welcome/index.html.erb content to a simple <h1>Hi</h1>, and then added a line in config/routes.rb which made it look like this
Rails.application.routes.draw do
get 'welcome/index'
root 'welcome#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
After saving those modifications, going to localhost:3000 gives me the following error:
I am using rails 5.0.1 and ruby 2.3.3 in case anyone asks
UPDATE:
I found a thread on some forum in German that seems to be dealing with the same problem. The person there suggested to modify the gemfile and add:
gem 'coffee-script-source', '1.8.0'
as well as run this command:
bundle update coffee-script-source
I've tried this but to no avail, it cannot execute the command(system cannot find the path specified).
What is going on?
I've managed to come up with a solution after a lot of failed attempts and frustration.
Apparently, the default runtime doesn't work properly with ruby on rails in windows. What fixes the error is installing the node.js runtime.
Download and install the node.js javascript runtime and don't forget to turn off your server and run it again before visiting the site again.
Cheers!
try to uncomment ruby-racer gem in Gemfile and run bundle.
I'm transferring redmine from our office's local server to an online server so that anyone who deals with bug management doesn't need to have a VPN account to access redmine.
So, We've chosen to use Bluehost.com because we saw their default Ruby version is 1.9.3(which works with redmine) while other hosts we've checked out were at 1.8.7
Okay I'm done establishing the backstory, now to the main storyline:
I'm trying for several days to install redmine on the server with no success.
The error I'm getting is this:
Error Message:
There was an error while trying to load the gem 'mysql2'.
(Bundler::GemRequireError)
Exception Class: PhusionPassenger::UnknownError
Here are some details:
Ruby version 1.9.3
Redmine version 3.2.2
Rails Version 4.2.5.2(installed as part of the bundle for redmine)
MySQL version 5.5.42
I've used a few guides on the web on how to install redmine on the server. one of whom was bluehost's guide:
https://my.bluehost.com/cgi/help/redmine
What I've tried after thoroughly searching StackOverflow:
I read that sometimes mysql2 gems have a problem and need to be reinstalled again after the bundle so I did gem install mysql2
I tried installing a specific version as well when someone here said that the mysql2 gem was working with bluehost on version 0.3.16 or other similar versions. Didn't work.
I even tried installing a local newer version of Ruby 2.3.1 but that didn't work either and only after I realized that the gems are not necessarily affected by the ruby version installed on the system.
I can't even use the test feature (like with WEBrick or Thin) because Bluehost wants you to own a dedicated server in order to open up special ports for you. We're using a shared host.
Anyway, after around 4 days of dealing with this I came to the conclusion that I need to seek out help. Sure I did learn practically the syntax of Ruby on Rails while dealing with this problem(which I was clueless on and have no knowledge in Ruby itself) but I need to get this done.
Does anyone have any insight on things I can try to get this working?
Here's a shot of the error:
Passenger Error
production.log data:
Migrating to InsertAllowedStatusesForNewIssues (20150725112753)
Migrating to CreateImports (20150730122707)
Migrating to CreateImportItems (20150730122735)
Migrating to ChangeTimeEntriesCommentsLimitTo1024 (20150921204850)
Migrating to ChangeWikiContentsCommentsLimitTo1024 (20150921210243)
Migrating to ChangeAttachmentsFilesizeLimitTo8 (20151020182334)
Migrating to FixCommaInUserFormatSettingValue (20151020182731)
Migrating to ChangeIssueCategoriesNameLimitTo60 (20151021184614)
Migrating to ChangeAuthSourcesFilterToText (20151021185456)
Migrating to ChangeUserPreferencesHideMailDefaultToTrue (20151021190616)
Migrating to AddTokensUpdatedOn (20151024082034)
Migrating to CreateCustomFieldEnumerations (20151025072118)
Migrating to AddProjectsDefaultVersionId (20151031095005)
in comparison, development.log is huge so I'll add a portion of it just to demonstrate the type of things written there.
I can access the cpanel and donwload the entire file if needed:
' ^[[1m^[[36m (0.2ms)^[[0m ^[[1mSHOW CREATE TABLE `wikis`^[[0m
^[[1m^[[35m (0.3ms)^[[0m SELECT fk.referenced_table_name as 'to_table'
,fk.referenced_column_name as 'primary_key'
,fk.column_name as 'column'
,fk.constraint_name as 'name'
FROM information_schema.key_column_usage fk
WHERE fk.referenced_column_name is not null
AND fk.table_schema = 'skredmin_redmine2'
AND fk.table_name = 'workflows'
Thanks for any insight!
Try 'bundle update mysql2'
I'm new to the server side of redmine but I experienced this issue when we updated mysql on our server. This did the trick for me, hope it helps.
I had to downgrade my version of mysql2 gem in the gemfile:
gem 'mysql2', '~> 0.3.18'
Then using a bundle update to downgrade the version.
I'm doing a tutorial on Ruby on Rails from Lynda, and everything has gone the way it should. All installations and everything has worked flawless.
But after creating a project, when I try to start the server (cmd: rails server) I get the error message:
LoadError: cannot load such file -- nokogiri/nokogiri
I have
* Windows 7 x64
* Rails 4.2.4,
* Gem 2.4.8.
I'm in the directory of the project. All files are there, everything looks ok. I created my project like this: ruby new test_cms and I also tried this: ruby new my_cms -d mysql . Same result.
Any ideas?
It looks as though nokogiri isn't be loaded, so you need it. So first think to do is check that it is in your Gemfile. If it is - move it to the top (I know - strange but it sometimes sorts out similar issues). If it's not, add it:
gem 'nokogiri'
Then run bundle install again.
Then try running bundle exec rails server to run the server with your bundle. You may be running it out of context.
If 'nokogirl' is located in your Gemfile maybe try updating your gems. try $ gem update --system.
Bluehost just upgraded their MySql version and broke my application.
I now get "Ruby (Rack) application could not be started" and this specific file load error:
libmysqlclient_r.so.16: cannot open shared object file: No such file or directory - /home4/mychairs/ruby/gems/gems/mysql2-0.3.11/lib/mysql2/mysql2.so
Notice the super long root-based path.
Running
bundle install
via SSH and then
bundle show mysql2
I am told that I am using this library:
/home4/mychairs/ruby/gems/gems/mysql2-0.3.11
I cannot tell where the abnormal path is being generated.
Remove the mysql gem manually and reinstall it via 'bundle install'. Bundler has no idea the underlying MySQL lib has changed, it just knows that the gem is there.
I've been fighting with a Rails install on my Mac for some time. The error I'm getting (in my development log) says:
Status: 500 Internal Server Error no such file to load -- mysql
Here's some info:
I can successfully rake db:migrate my application.
I've installed the MySQL gem and it appears in the gem list: mysql (2.8.1).
I have Passenger installed.
The error comes from an existing rails app that works on our production server.
Creating a new Rails app, a new MySQL db (using mysqladmin -uroot create sampledb) works fine.
I've googled this and can't find anything specific to this error. There are a few related results where the solutions relate to paths when installing the MySQL gem. For example,
sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
--with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-include=/usr/local/mysql/include
Has anyone else experienced this issue or suggest a solution?
Thanks for the response - the good news is, the problem is solved.
The bad news - I'm not entirely sure what fixed it. I can tell you this: it had something to do with the mysql gem install and all the flags pointing to lib, include and config. There are probably a dozen different versions of the same command floating around out there for Mac OS X Leopard.
The odd thing was that ruby appeared to be connected to mysql on some level (it's ability to rake db for example) but broke when actually loading a page.
The gem install string that ended up working was this:
sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
I'd love some clarification on the how's & why's of this. This worked for me, but doesn't include pointers to the app directory, the lib directory or the include directory.
Do you have multiple ruby installed? Try invoking this command to find out: whereis ruby
Which ruby version is you passenger using? You can check this from your apache or nginx configuration
Is the ruby version passenger is using the same as ruby you are using from the command line?
Is mysql gem installed on that ruby version?
Double check if the mysql bin path is in your $PATH system environment variable. If you execute
*echo $PATH*
there must be displayed something like
*/usr/local/mysql/bin*
You can also type
mysql and then the tab-key twice.
If if this doesn't bring up a list of mysql commands (like mysqladmin etc.) the mysql bin path is not set ccorrectly. You can set it by adding the correct directory to your bash profile file.
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
Please verify up front if
*/usr/local/mysql/bin*
really contains the mysql commands on your Mac. Important: close and reopen the terminal window to make changes work.