1

I have hard time to configure a dev environement for rails getting some errors

I have install ruby & rails with this tutorial https://parsun.com/2017/09/23/how-to-install-ruby-on-rails-on-raspberry-pi-3/ but i have some error when i launch a project

An error occurred while installing mysql2 (0.5.2), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'` succeeds before bundling.

i have tried to launch :

gem install mysql2

but i get that ... https://pastebin.com/8CxsVzMQ

SubFlow
  • 11
  • 2
  • Possible duplicate of [Error installing mysql2: Failed to build gem native extension](https://stackoverflow.com/questions/3608287/error-installing-mysql2-failed-to-build-gem-native-extension) – thesecretmaster Aug 03 '19 at 16:11

1 Answers1

0

You need to install mysql first, the log contains

mysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again.

The documentation page of the mysql2 gem contains:

This gem links against MySQL's libmysqlclient library or Connector/C library, and compatible alternatives such as MariaDB. You may need to install a package such as libmysqlclient-dev, mysql-devel, or other appropriate package for your system. See below for system-specific instructions.

By default, the mysql2 gem will try to find a copy of MySQL in this order:
* Option --with-mysql-dir, if provided (see below).
* Option --with-mysql-config, if provided (see below).
* Several typical paths for mysql_config (default for the majority of users).
* The directory /usr/local.

Try to install mysql or the mentioned libs and try again to install the gem.

The messages do not seem to reflect reality, try this instead of the mentioned package:

sudo apt-get install default-libmysqlclient-dev

Then, your next error clearly shows what is wrong

/home/pi/.rvm/gems/ruby-2.6.3/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect': Could not find a JavaScript runtime. See github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

The GH page says:

ExecJS lets you run JavaScript code from Ruby. It automatically picks the best runtime available to evaluate your JavaScript program, then returns the result to you as a Ruby object.

Install one of the javascript runtimes, listed here in the readme, e.g. nodejs (https://nodejs.org/en/download/), therubyracer, etc.

Christian
  • 4,902
  • 4
  • 24
  • 42
  • i forgot to say i already use the command and i get that ... https://pastebin.com/ibCW6F8y – SubFlow Aug 01 '19 at 21:47
  • Edited my answer, try: sudo apt-get install default-libmysqlclient-dev – Christian Aug 01 '19 at 21:54
  • News error i have succed to create the project but not to launch https://pastebin.com/WBpxrvQ7 – SubFlow Aug 01 '19 at 22:15
  • The error clearly shows what is wrong /home/pi/.rvm/gems/ruby-2.6.3/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) ExecJS lets you run JavaScript code from Ruby. It automatically picks the best runtime available to evaluate your JavaScript program, then returns the result to you as a Ruby object. Install one of the mentioned javascript runtimes, e.g. nodejs. – Christian Aug 01 '19 at 22:23
  • it's really nice to try to help me but still dosen't work :( https://pastebin.com/m7Xj2DZS – SubFlow Aug 01 '19 at 22:26
  • no, not execjs. Install one of the interpreters in the list, e.g. nodejs (https://nodejs.org/en/download/). I have updated my answer. – Christian Aug 01 '19 at 22:29
  • actually your question was about mysql and this is installed, right? I suggest to close this discussion and ask you to create a new question with sample log output and how to get your server running with one of the javascript runtimes. – Christian Aug 01 '19 at 22:30