Develop docker-compse service locally - package.json: engines.node must be specified

I have a multi-container app with a docker-compose.yml in the root directory.
Building via balena cloud works fine (git push balena).

What does not work is pushing to a local device in development mode.

$ balena push 192.168.178.94
[Info]    Starting build on device 192.168.178.94
[Info]    Creating default composition with source: .
package.json: engines.node must be specified

Hello, the error you report seems to indicate that you need to specify the engines keyword in your package.json (have a look at https://docs.npmjs.com/files/package.json#engines) I am not sure why that is required for local mode though, I will ask the team and get back to you on this but in the meantime I would suggest trying to add that and seeing if it unblocks you.

Could you also provide us with some info about what version of the OS, Supervisor and balena-cli you are currently using? Thank you

Actually, there is no package.json.
Rather, there is a docker-compose.yml.

Host OS Version
balenaOS 2.46.1+rev3

Supervisor Version
10.6.27

balena cli version
11.19.1

Thank you. Just one more thing: could you also try running the push with DEBUG=1 (e.g. DEBUG=1 balena push ...) and let us know if there are any other logs appearing?

Actually, there is no package.json .
Rather, there is a docker-compose.yml .

Nonetheless, for some reason the CLI is failing to find or to parse the docker-compose.yml file in the “current working directory” (current folder). When this happens, the CLI looks for a Dockerfile or a package.json file as alternatives. Suggestions:

  • Check that the balena push command is being executed on the correct folder – i.e. run cd to the folder where docker-compose.yml is, or use the --source option (CLI issue 1421).
    • In particular, check that balena push is not being executed in a project subdirectory (perhaps one that contains a package.json file).
  • Check that the docker-compose.yml file is not listed in any .gitignore or .dockerignore files, even any such files in project subdirectories (CLI issue 1032).
  • Check that the docker-compose.yml file meets the compatibility requirements (even though this should not be the problem, as you mentioned that git push works):

Could any of the above be the case?

1 Like

Indeed, the source directory was the issue.

I double checked, and I was running

yarn --cwd build/balena-cli balena push 192.168.178.57

Adding --source $PWD fixes the problem.

Thank you!