Failing assets:precompile without error output

I have been trying to execute:
RAILS_ENV=production bundle exec rails assets:precompile
But I keep getting the following output:

    yarn install v1.16.0
    [...]
    Compiling...
    Compilation failed:

After compilation failed there is a single blank new line.

I thought I was running out of memory, so I increased SWAP to 12GB (2GB RAM + 12GB SWAP) and stopped all mastdon-* services.

After re-running the command I get the same problem.
I have no idea what is going on as no error is returned. Any ideas?

Running Mastodon 2.9.2. Managed to compile with 1GB RAM + 3GB SWAP when I configured the instance for the first time.

EDIT: Tried to allocate 25GB t o swap, same issue.

Can you post a full output somewhere?

Yes, sure:

mastodon@mstdn:~/live$ RAILS_ENV=production bundle exec rails assets:precompile
yarn install v1.16.0
[1/6] Validating package.json...
[2/6] Resolving packages...
[3/6] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/6] Linking dependencies...
warning " > react-redux-loading-bar@4.0.8" has incorrect peer dependency "react-redux@^3.0.0 || ^4.0.0 || ^5.0.0".
[5/6] Building fresh packages...
[6/6] Cleaning modules...
Done in 47.91s.
Compiling…
Compilation failed:

mastodon@mstdn:~/live$ 

This is the complete output.
I tried with both Ruby 2.6.1 and 2.6.3.

I could try to install the new master branch and see if the problem gets solved, unless someone has better ideas.

EDIT: Still failing after updating yarn to v1.17.3

So, I have tried to precompile assets on a different machine with a snapshot of my server: same error-less problem.

I have tried to do a git checkout at both v2.9.2 and master branch (obviously updated gems etc.) and that did not solve the issue.

Is everyone else able to precompile assets?

Since no error is ever returned I did whatever popped up in my mind as a potential issue to try to troubleshoot this, but now I am really out of ideas. Can anyone think of what could be causing this? I’m willing to try anything at this point…

My instance is running fine, but I am afraid I will never be able to update my instance if an update requires asset precompilation.

And I am sure it’s not an out-of-memory issue at this point (unless precompiling assets requires more than 30GB memory, which I doubt it’s the case).


In v2.9.2 (master branch doesn’t do this) I also encounter this problem:

I also noticed that if I do not run yarn before running RAILS_ENV=production bundle exec rails assets:precompile the output would look like this.

~/live$ RAILS_ENV=production bundle exec rails assets:precompile
yarn install v1.17.3
[1/6] Validating package.json...
[2/6] Resolving packages...
Done in 2.91s.
Compiling…
Compilation failed:

For some reason, it skips 4 steps.

However, if I first run yarn and then (try to) precompile the assets, then the output is:

~/live$ RAILS_ENV=production bundle exec rails assets:precompile
yarn install v1.17.3
[1/6] Validating package.json...
[2/6] Resolving packages...
[3/6] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/6] Linking dependencies...
warning " > react-redux-loading-bar@4.0.8" has incorrect peer dependency "react-redux@^3.0.0 || ^4.0.0 || ^5.0.0".
[5/6] Building fresh packages...
[6/6] Cleaning modules...
Done in 47.91s.
Compiling…
Compilation failed:

~/live$

In both cases, the compilation fails without error.

Yes, there are dozens of people running master and thousands of people successfully running 2.9.2, and they’ve all been able to precompile assets. My guess is that there’s something in your system configuration that’s broken.

You can try these steps to enable more logging on webpack errors: Error messaging when running rake assets:precompile · Issue #1677 · rails/webpacker · GitHub
this should make it easier to debug whatever’s going on.

Thank you so much for that link.
I managed to solve the problem immediately.

Can you tell us how?

I went into

~/live/config/webpacker.yml

and on line 10 I changed

webpack_compile_output: false

to true.

Then I ran ~/live$ RAILS_ENV=production bundle exec rails assets:precompile again, and it threw a long error output.

After looking into it I noticed that there was an unexpected character in one of my *.js files, which was causing the problems.

I think this survived the git checkout because I did not stash some changes I made first and didn’t notice the output. Definitely a big oversight on my side.

Therefore, if it is not a memory issue (which can result in no output as described in #5696) it is most likely webpacker not managing to compile all your files.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.