What to do if ffi installation fails when launching an application in Rails

I succeeded in installing the Rails version with Ruby on Rails, but when I started the Rails application, the installation of ffi failed as shown below. I will leave the remedy I took at that time.

Error message

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

Cause

Probably due to the Mojave environment of MacOS. As for the cause, it seems that there is no ffi when installing Ruby with Homebrew.

Solution

First, reinstall libffi for Mojave because you don't have ffi. Reinstall using the following method.

brew reinstall libffi

However, at present, the libffi path is invisible, so specify it.

export LDFLAGS="-L/usr/local/opt/libffi/lib" && \
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" && \
bundle install

Now the ffi installation error is gone and the rails application is running!

Reference article

Recommended Posts

What to do if ffi installation fails when launching an application in Rails
What to do when an UnsupportedCharsetException occurs in a lightweight JRE
[Rails] What to do if data is not registered in DB
What to do if the Rails page doesn't appear in Rails tutorial 1.3.2
What to do if Cloud9 is full in the Rails tutorial
What to do if you get an error in Basic authentication during Rails test code
<Dot installation> What to do if you cannot proceed due to an error when building a development environment for Rails learning.
[Programming beginner] What to do when rails s becomes an error in the local development environment
What to do if an error occurs when doing npm install axios in React + Typescript project
What to do when Blocked Host: "host name" appears in Ruby on Rails
What to do if an error occurs when nokogiri enters when bundle install
What to do if tomcat process remains when tomcat is stopped in eclipse
What to do if mvn archetype: generate fails
What to do when IllegalStateException occurs in PlayFramework
What to do if the Rails server can't start
What to do if ClassNotFoundException occurs when starting Tomcat
What to do if rails server can't be stopped
What to do if an ActionController :: UnknownFormat error occurs
What to do if you get an "A server is already running." Error when you try to start the rails server
After installing'devise''bootstrap' of gemfile with rails, what to do when url is an error
What to do if you get an error saying "Please enter a valid value" when getting with Rails datetime_field
What to do if you get an error saying "Could not find a JavaScript runtime." When starting rails server
What to do when Method not found in f: ajax
What to do if you can't use the rails command
[Rails] What to do if you accidentally install bundle in the production environment in your local environment
[Rails] What to do if you can't get an error message with the errors method
What to do if you get a "302" error in your controller unit test code in Rails
What to do when an error occurs in rails db: migrate ((StandardError: An error has occurred, this and all later migrations canceled :))
What to do when an error (StandardError: An error has occurred, this and all later migrations canceled:) appears in rails db: migrate
What to do when javax.batch.operations.JobStartException occurs
What to do if you get a gcc error in Docker
What to do when the changes in the Servlet are not reflected
[Rails] What to do when rails s does not respond or does not stop
What to do if you forget the root password in CentOS7
[Rails] What to do if you can't get parameters with form_with
[Rails] What to do when the error No database selected and Unknown database appears in db: migrate
Notes on what to do if Ubuntu 20.04 installation on Virtual box 6.1 (Windows10) fails with "Error 5 Input / output error"
What to do if you get a JNI shared library error when trying to build in Eclipse
What to do if you get an [An HTTP request took too long to complete.] Error in Docker.
What to do if the app is not created with the latest Rails version installed when rails new
Add gem'rails-i18n','~> 6.0.0' and what to do if bundle install gives an error
What to do if the prefix c is not bound in JSP
What to do if you get an error with bundle install by entering gem'bcrypt' in your Gemfile
What to do when a javax.el.PropertyNotWritableException occurs
What to do if you get Application with name appName is already registered. When you try to start GlassFish
What to do if the image posted by refile disappears after setting a 404 error page in Rails
What to do if zip dies if there is a pom when making an executable jar with gradle
What to do if deployment fails on Heroku (Ruby app not detected)
no space left on device What to do if an error occurs
What to do if Operation not permitted is displayed when you execute a command in the terminal
What to do when undefined method ʻuser_signed_in?'
What to do when "call'Hoge.connection' to establish a connection" appears on rails c
Notes on what to do when a WebView ClassNotFoundException occurs in JavaFX 12
[Rails] What to do if you get an error saying "Could not find a JavaScript runtime." When executing the rails s command on Catalina
What to do if you have enabled Use the WSL2 based engine in Docker Desktop with insufficient WSL2 installation
What to do if Command line is too long appears when building a gradle project in Intellij IDEA
What to do if the changes are not reflected in the jar manifest file
What to do when the value becomes null in the second getSubmittedValue () in JSF Validator
wildflly10 java8 ERROR [org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl] (Periodic Recovery) IJ000906 What to do if an error occurs
Nuxt.js × Create an application in Rails API mode
What to do if the server tomcat dies