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 with recent new phoenix app #7

Open
febeling opened this issue Oct 11, 2023 · 2 comments
Open

Build failure with recent new phoenix app #7

febeling opened this issue Oct 11, 2023 · 2 comments

Comments

@febeling
Copy link

febeling commented Oct 11, 2023

There are two problems when deploying an app generated with a recent Phoenix version (1.7.7):

  1. The buildpack assumes there is a assets/package.json and fails when installing deps from it. The most recent phoenix 1.7 doesn't place this file there. This is the log tail (deployment to Dokku).
-----> Installing binaries
       /cache/node-v18.18.0-linux-x64.tar.gz: OK
       Using cached node 18.18.0...
       Installing Node 18.18.0...
       Downloading and installing npm 10.2.0 (replacing version 9.8.1)...
       
-----> Building dependencies
       Installing node modules
       
       up to date in 517ms
       npm ERR! code ENOENT
       npm ERR! syscall open
       npm ERR! path /tmp/build/assets/package.json
       npm ERR! errno -2
       npm ERR! enoent ENOENT: no such file or directory, open '/tmp/build/assets/package.json'
       npm ERR! enoent This is related to npm not being able to find a file.
       npm ERR! enoent
       
       npm ERR! A complete log of this run can be found in: /app/.npm/_logs/2023-10-11T11_41_08_245Z-debug-0.log
remote:  !     Failure during app build
remote:  !     Retagging old image 2e974a41ab58 as dokku/testapp-ex:latest
remote:  !     App build failed
  1. The build command is now mix assets.deploy instead of the previous mix $phoenix.digest. This is an alias from mix.exs, which still runs phx.digest, but after tailwind and esbuild.
@febeling
Copy link
Author

febeling commented Oct 11, 2023

@febeling
Copy link
Author

Workaround/Solution

Place an empty package.json into assets/ and override the compile command.

The package.json can look like this:

{
  "name": "myapp",
  "version": "0.0.1",
  "description": "placeholder package.json to pacify static buildpack",
  "main": "js/app.js"
}

The compile can be overridden by placing a file compile in the project root directory with this content:

cd $phoenix_dir
mix assets.deploy

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

1 participant