Ran This:
RUN RAILS_ENV=production rake assets:precompile
Received this:
Compiling...
Compilation Failed:
Context
I was in the middle of building a docker production image for a rails application with precompiled javascript assets baked into the image and this error kept occuring within the Alpine image I was attempting to precompile the assets.
TLDR: I am still new to Javascript (and I am really starting to come around to it), but I was using both yarn and npm.
Webpacker does not like this. package.json
does not like this. package-lock.json
doesn’t like this. I am pretty sure yarn.lock
doesnt like this. And even Rails didnt like this! It was just a bad combo.
When you see an error what do you do?
I saw this error and I had no idea what to do. Usually I am pointed to a line number or a method that is broken due to failed dependencies. This was new to me. This error failed silently reporting no issues besides this note and exiting from the docker build with an exit status of 1.
I was really stuck for a while and didn’t know what to do, so I did what any hacker would do and Googled it. Google came up with a few issues
Update Alpine Packages to Edge!
https://github.com/gliderlabs/docker-alpine/issues/342
What the crust. There were 2 different node versions I needed to get the most current yarn version and the latest npm version for the image.