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

Build Failure on Netlify with new elm-pages project #357

Open
EvanPiro opened this issue Jan 8, 2023 · 3 comments
Open

Build Failure on Netlify with new elm-pages project #357

EvanPiro opened this issue Jan 8, 2023 · 3 comments

Comments

@EvanPiro
Copy link
Contributor

EvanPiro commented Jan 8, 2023

I'm receiving the following error when I run a deployment via netlify on a clean elm-pages project. It does work on my local (x86_64-darwin). I'm digging into this but I wanted to post this issue in case there's an obvious fix to someone more familiar with netlify.

12:48:30 PM: > build
12:48:30 PM: > elm-pages build
12:48:33 PM: Ran elm-review in 160ms
12:48:33 PM: -- PROBLEM BUILDING DEPENDENCIES -----------------------------------------------
12:48:33 PM: I ran into a compilation error when trying to build the following package:
12:48:33 PM:     elm/core 1.0.5
12:48:33 PM: This probably means it has package constraints that are too wide. It may be
12:48:33 PM: possible to tweak your elm.json to avoid the root problem as a stopgap. Head
12:48:33 PM: over to https://elm-lang.org/community to get help figuring out how to take this
12:48:33 PM: path!
12:48:33 PM: Note: To help with the root problem, please report this to the package author
12:48:33 PM: along with the following information:
12:48:33 PM: If you want to help out even more, try building the package locally. That should
12:48:33 PM: give you much more specific information about why this package is failing to
12:48:33 PM: build, which will in turn make it easier for the package author to fix it!
12:48:33 PM: Compilation failed.
12:48:33 PM: ​
12:48:33 PM:   "build.command" failed                                        
12:48:33 PM: ────────────────────────────────────────────────────────────────
12:48:33 PM: ​
12:48:33 PM:   Error message
12:48:33 PM:   Command failed with exit code 1: export ELM_HOME="$NETLIFY_BUILD_BASE/cache/elm" && npm install --no-optional && npm run build (https://ntl.fyi/exit-code-1)
12:48:33 PM: ​
12:48:33 PM:   Error location
12:48:33 PM:   In build.command from netlify.toml:
12:48:33 PM:   export ELM_HOME="$NETLIFY_BUILD_BASE/cache/elm" && npm install --no-optional && npm run build
12:48:33 PM: ​
12:48:33 PM:   Resolved config
12:48:33 PM:   build:
12:48:33 PM:     command: export ELM_HOME="$NETLIFY_BUILD_BASE/cache/elm" && npm install --no-optional && npm run build
12:48:33 PM:     commandOrigin: config
12:48:34 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
@dillonkearns
Copy link
Owner

Hello @EvanPiro, there's a thread here where we finally realized what was happening there:

https://discourse.elm-lang.org/t/problem-building-dependencies-error-in-pipeline-solved/8755

The issue occurs intermittently when the Elm compiler is running multiple instances in parallel. elm-pages is doing this to build the client bundle as well as the backend bundle (for resolving DataSources and rendering HTML for the pages in the build step).

I have a fix for this in the v3 beta, which will be going to a release candidate shortly. It might also make sense to do a hotfix for this issue in the v2 branch to avoid this problem before v3 is stable and while people migrate to v3.

@dillonkearns
Copy link
Owner

If you do a clear cache and rerun build in Netlify it can sometimes resolve this issue. It can take a few tries, though. I believe that once a good cache is present the issue doesn't get triggered again with that set of dependencies because the issue comes from a race condition when multiple instances of the Elm compiler are trying to install the same dependency at the same time.

@EvanPiro
Copy link
Contributor Author

EvanPiro commented Jan 9, 2023

@dillonkearns 4th try did the trick.

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

2 participants