Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Failed without error message #955

Closed
schepens83 opened this issue Oct 16, 2017 · 25 comments
Closed

Compilation Failed without error message #955

schepens83 opened this issue Oct 16, 2017 · 25 comments

Comments

@schepens83
Copy link

Hello

I have a problem using rails 5.1, webpacker and Vue2.js during deployment to a digital ocean ubuntu droplet. The compilation process fails without an error message. Sometimes the whole process hangs during compilation and I have to reboot the server. The application is very basic with little additional code or configuration other than what's standard out of the box.

See also this stackoverflow question for more details. You can see the code here.

@gauravtiwari
Copy link
Member

@schepens83 Please consider bumping up the instance memory or compile your assets locally and then push it to production. Webpack uses considerable amount of memory during compilation.

@schepens83
Copy link
Author

@gauravtiwari Thanks for the tip. I take it you mean I run bin/bundle exec webpacker:compile locally. Check in the new files in the git repo and push to server? How do I prevent the webpacker:compile to run when I run RAILS_ENV=production bin/bundle exec rake assets:precompile on the server?

@gauravtiwari
Copy link
Member

If you compile your assets locally, then you don't need to run - RAILS_ENV=production bin/bundle exec rake assets:precompile on the server

@gauravtiwari
Copy link
Member

Just run this locally - RAILS_ENV=production bin/bundle exec rake assets:precompile and then commit the assets to git and deploy it to production.

@schepens83
Copy link
Author

schepens83 commented Oct 16, 2017

@gauravtiwari Alright, that solved it! Thanks for the help.

For future viewers; simple thing, but I had to delete the automatically added public/packs/ line from my .gitignore file, to make it work.

@schepens83
Copy link
Author

@gauravtiwari Just as an additional question. How much (additional/total) memory would the droplet require to stop having this problem?

@gauravtiwari
Copy link
Member

@schepens83 Depends on how big the app is, but please try bumping up to 1GB and see if that solves the problem.

@jstdoit
Copy link

jstdoit commented Mar 17, 2018

just bumping the memory size solved my problem, thanks @gauravtiwari

@ch-tactica
Copy link

Why is it failing without an error message? The OP might have resolved their issue, but this is still a bug as far as I can tell.

@betaflag
Copy link

betaflag commented Jun 5, 2019

Why is it failing without an error message? The OP might have resolved their issue, but this is still a bug as far as I can tell.

👆 This! I had to dig up here to find it might be a memory issue.

This issue might also come up more often then you think. My app has about 10 React components, 3 reducers and I'm hitting this problem on Heroku. (I'm not yet sure it's a memory limitation but the compilation works correctly locally.)

@jakeNiemiec
Copy link
Member

@betaflag @ch-tactica Error details were suppressed to reduce dev server output in development: #1834 (comment). I didn't agree with that choice, but perhaps a PR with supporting evidence from an actual app would make a better case than I did.

If you want to skip to a solution, here are a few things that can make your output more detailed: #1824 (comment)

@connorshea
Copy link
Contributor

In case anyone else runs into this, I had to set webpack_compile_output: true in webpacker.yml for rails assets:precompile to output anything on failure.

I don't really understand why it wouldn't be outputting things regardless of that option on failure, but 🤷‍♂

@masato-hi
Copy link
Contributor

Probably related #2143

@BillyParadise
Copy link

this helped a lot, devs PLEASE make logging default to ON for production. I fought this for a week to find it was a missing file.

@xiobot
Copy link

xiobot commented Jul 1, 2019

Such a terrible decision to remove this by default, it really fucked me up!

Excuse my french!

@joeyparis
Copy link

Such a terrible decision to remove this by default, it really fucked me up!

Agreed! Adding @connorshea's webpacker.yml config suggestion helped me find the actual problem immediately. Removing this was an awful decision.

@andresuchitra
Copy link

My app faced webpacker compiled failed but no details message.
webpack_compile_output: true is already set

Would anyone mind to help me on how to get details message please?

@rajdeepbhatia
Copy link

For those who run the precompilation step in Dockerfile, set compile to false in webpacker.yml to avoid running it twice. Happened with us in staging, where by default the compile is set to true and it kept running out of memory.

@joeadcock
Copy link

@andresuchitra Not sure if this helps, but I just ran into a silent failure because I didn't have yarn installed on the server.

@Tuuleh
Copy link

Tuuleh commented Jun 4, 2020

I'm running this on CircleCI 2.0, getting a silent failure with webpack_compile_output: true already set. Furthermore, it's not failing on every build - it's often successful on reruns. It logs a bunch of stuff when it's successful and just fails silently when it does fail (most of the time).

Compiling…
 
Compilation failed:
 

 

 
 
Exited with code exit status 1 
CircleCI received exit code 1 

I suspect it might be a memory issue, but haven't had the time to really research it that much yet.

Edit: seems to have been a resource issue indeed, it was resolved after we upgraded our plan over the weekend

@ciremoussadia
Copy link

ciremoussadia commented Nov 9, 2020

@Tuuleh It seems webpack is taking too much memory so if you're on a small server it will go out of memory and the process will be killed. The solution is to tell node to use small amount of memory by defining this env var NODE_OPTIONS="--max-old-space-size=350"
U can read more here...

@gamesover
Copy link

Thanks for everyone's contributes.

As @Tuuleh said, it was caused by lacking of enough memory.

@ciremoussadia offers a great solution if you cannot increase machine's memory.
However, 350M memory may be too small for some cases. You may try a big number.
It helps us after increasing to 4096, NODE_OPTIONS="--max-old-space-size=4096"

@thadeu
Copy link

thadeu commented Apr 19, 2021

Great! I solved my problem with webpack_compile_output only production

@guicassolato
Copy link

Compiling…
 
Compilation failed:
 

 

 
 
Exited with code exit status 1 
CircleCI received exit code 1 

I was having the same issue on macOS, with NODE_OPTIONS="--max-old-space-size=4096". It turns, in my case, all I had to do was adjusting the resource settings in Docker Desktop.

@jshah
Copy link

jshah commented Sep 29, 2021

@rajdeepbhatia

For those who run the precompilation step in Dockerfile, set compile to false in webpacker.yml to avoid running it twice. Happened with us in staging, where by default the compile is set to true and it kept running out of memory.

Could you explain why this is? Why would it run twice?

My understanding was that this setting only compiles if you haven't already compiled assets. As long as the assets you compiled in the docker image live in the correct directory (directory at public_output_path) it will use them. Otherwise, it will compile assets again since it can't find the assets.

If you've set compile: false and your tests still pass, it probably means you don't need precompiled assets in your tests and you could probably get away with not even precompiling in your Dockerfile (if you use a different image for test vs other environments).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests