balena-cli icon indicating copy to clipboard operation
balena-cli copied to clipboard

balena push: Could not detect project type: Service main: Couldn't satisfy node version >=4

Open jane-rose opened this issue 4 years ago • 13 comments

  • balena CLI version: 11.33.3
  • Operating system version: macOS 10.15.4
  • 32/64 bit OS and processor: MacBook Pro 16-inch, 2019, so 64 bit
  • Install method: release
  • Node: v10.16, npm: v6.9.0

image

jane-rose avatar May 12 '20 12:05 jane-rose

image

jane-rose avatar May 12 '20 12:05 jane-rose

@jiantaolovebingbing, thanks for reporting this issue. A balena project (application) is most commonly defined with a Dockerfile, but may be also be defined with a package.json file, as documented at:

  • https://www.balena.io/docs/learn/develop/dockerfile/
  • https://www.balena.io/docs/learn/develop/dockerfile/#node-applications

The error message suggests that your project uses a package.json file instead of a Dockerfile. Is this right?

To try and reproduce the error you were getting, I created a folder with a trivial package.json file with these contents:

{
  "engines": {
    "node": ">=4.0"
  }
}

Then I tested the balena push command with that folder, against a Raspberry Pi 3 (32 bits), a Raspberry Pi 4 (64 bits) and an Intel NUC. I was able to reproduce the error with the Raspberry Pi 4 only:

$ ./bin/balena push 192.168.0.37 -s ~/test-project/
[Info]    Starting build on device 192.168.0.37
[Info]    No "docker-compose.yml" file found at "/Users/paulo/test-project/"
[Info]    Creating default composition with source: "/Users/paulo/test-project/"
Couldn't satisfy node version >=4

With a Raspberry Pi 3 or the Intel NUC, the error did not happen:

$ $ ./bin/balena push 192.168.0.12 -s ~/test-project/
[Info]    Starting build on device 192.168.0.12
[Info]    No "docker-compose.yml" file found at "/Users/paulo/test-project/"
[Info]    Creating default composition with source: "/Users/paulo/test-project/"
[Build]   [main] Step 1/4 : FROM resin/raspberrypi3-node:10.10.0-onbuild
...
[Build]   [main] Step 2/4 : RUN ln -s /usr/src/app /app
[Build]   [main]  ---> Running in c71a7b59bdad
[Build]   [main] Removing intermediate container c71a7b59bdad
[Build]   [main]  ---> 4d1c0a18e204
[Build]   [main] Step 3/4 : LABEL io.resin.local.image=1
[Build]   [main]  ---> Running in 8dec3565f4ae
[Build]   [main] Removing intermediate container 8dec3565f4ae
[Build]   [main]  ---> c1fbc62c6df0
[Build]   [main] Step 4/4 : LABEL io.resin.local.service=main
[Build]   [main]  ---> Running in cde62d128247
[Build]   [main] Removing intermediate container cde62d128247
[Build]   [main]  ---> 72c765c6017f
[Build]   [main] Successfully built 72c765c6017f
[Build]   [main] Successfully tagged local_image_main:latest

[Live]    Waiting for device state to settle...
[Info]    Streaming device logs...
[Live]    Watching for file changes...
...
[Logs]    [5/12/2020, 17:22:00] Started service 'main sha256:72c765c6017fae0f81fc7a1c62e144f7556448070e1bfea0d360c63381711266'
[Live]    Device state settled

Which device type are you using? (Like Raspberry Pi 4, or something else.)

Overall, also for performance reasons, if your project does not have a Dockerfile, I would recommend that you created one, following the documentation links above. But I will wait for your reply before writing any further. :-)

pdcastro avatar May 12 '20 16:05 pdcastro

My device type is Raspberry Pi 3 model B+. But I don't add device, i think it would't affect the push action. image

jane-rose avatar May 13 '20 02:05 jane-rose

IMG_5655

jane-rose avatar May 13 '20 02:05 jane-rose

I have added the device, but still the same error. One thing i noticed, my device is 32bit, my OS file is based on Raspberry Pi 3(using 64bit os), does it affect? image

jane-rose avatar May 13 '20 03:05 jane-rose

Yes, my project uses a package.json file. I tried electron-based project and nodejs-based project, all go wrong.

jane-rose avatar May 13 '20 06:05 jane-rose

@jiantaolovebingbing, thank you for the additional information. The "workaround" suggestion for now is that you add a Dockerfile.template file to your project, for example this file from the balena-node-hello-world sample project. More documentation about Dockerfiles in balena projects can be found at: https://www.balena.io/docs/learn/develop/dockerfile/

my OS file is based on Raspberry Pi 3(using 64bit os), does it affect?

I can reproduce the error and I can confirm that it is a bug that needs to be fixed -- thank you again for reporting it. Meanwhile, please add a Dockerfile.template file as suggested above. It should then work regardless of the device type.

pdcastro avatar May 13 '20 10:05 pdcastro

thanks a lot! It works.But there are other problem during the push. I installed the python environment, but I get an error python not found in path. Should I install python 3? image

jane-rose avatar May 13 '20 12:05 jane-rose

image

jane-rose avatar May 13 '20 12:05 jane-rose

I get an error python not found in path

I believe this is now an issue with getting the Snapmakerjs project to work with a balenalib base image, rather than a balena CLI bug. If you need help with setting up the Snapmakerjs project, I suggest creating a thread in the balena support forums, which is monitored by balena's support team and the wider community: https://forums.balena.io/c/balena-cloud/ Thanks again.

pdcastro avatar May 13 '20 12:05 pdcastro

Never mind! my fault, just changing the Dockerfile.template file can fix it! thanks again. But how could the status is still inactive? image image

jane-rose avatar May 13 '20 12:05 jane-rose

But how could the status is still inactive?

It looks like the device did not boot successfully, or perhaps a local network firewall is blocking the VPN link. See Network Requirements. For further troubleshooting help, I suggest creating a thread in the balena support forums, which is monitored by balena's support team and the wider community: https://forums.balena.io/c/balena-cloud/ Thanks again.

pdcastro avatar May 13 '20 15:05 pdcastro

I had the same issue stated in the issue title and my problem was that by mistake I was running balena push from the app folder where I had the app package.json. I should ve run the command from the parent folder that held the Dockerfile.template. So Balena was trying to make sense of the package.json as a Dockerfile replacement which led to the correct but misleading error.

ccimpoi avatar Jul 14 '22 15:07 ccimpoi