Autoprefixer does n’t support Node v4.8.2. Update it. Error that occurred in Rails [Docker Rails5 Bootstrap]

Introduction

When I was developing Rails with Docker, the following error suddenly occurred and I could not open the application. 6f7d96c8994be656c8439daf32b138aa.png

First, if you look at the error statement, it says "Autoprefixer doesn't support Node v4.8.2. Update it.", And when translated, "Autoprefixer does not support Node v4.8.2. Please update." . ".

When I check the version of Node.js by executing the following command, it seems to be v4.8.2 as the error statement.

docker-compose run app nodejs -v
v4.8.2

Cause

Upon investigation, I found that Bootstrap was the cause. In the Bootstrap source code, the vendor prefix is not intentionally described and everything is left to a module called Autoprefixer, and this module does not accept Node.js version v.4.8.2.

Once you know the cause, just deal with it! Changing the version of Node.js in the container should solve it ...

approach

The OS that makes up the Rails container is debian Linux, and you can add the repository (software acquisition source) used by the apt-get command of the debian package management command "apt". Add the version 10 Node.js repository before the Node.js apt-get described in the Dockerfile.

Dockerfile


+ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -

RUN apt-get update -qq && \
    apt-get install - y build-essential \
            libpq-dev \
            nodejs

Now version 10 Node.js is installed. If the container is running, stop it, rebuild it without using the cache, and then start it.

docker-compose stop
docker-compose build --no-cache
docker-compose up -d

Finally

The application screen was displayed normally with the above support. スクリーンショット 2020-11-05 7.52.30.png

I'm happy.

Recommended Posts

Autoprefixer does n’t support Node v4.8.2. Update it. Error that occurred in Rails [Docker Rails5 Bootstrap]
[Docker] The story that an error occurred in docker-compose up
Error in docker rails db: migrate (StandardError: An error has occurred, all later migrations canceled :)