An unknown error has occurred [incompatible_app_runtime_nodejs]

I’m working on an app and I’m running into this error message when trying to install it on a Homey Pro 2019. When installing from the store, the usual message “… will be installed on your Homey shortly” appears, but the app never shows up on the Homey.

When trying to run the app locally (homey app run --clean) we get this error:

The message itself looks fairly self-explenatory, but I have absolutely no clue what’s triggering it. There’s no mention of it anywhere in the docs; I can’t even find it in the Homey CLI source code repositories. And if it’s actually not directly Homey related, there’s no mention of this error anywhere on the internet.

Has anyone encountered this before?

This is from the Homey in question:

Tagging @Peter_Kawa as he’s kindly helping me trying to figure this one out.

I also have a Homey Pro 2019 but never get that error when running homey app run. Are you building a JS app? Which dependencies does it use? I think it’s an issue with a dependency that requires a newer version of Node

Yes, its and nodejs app. Nothing funky in my dependencies:

{
  "name": "nl.creitive.enlighten",
  "version": "1.2.1",
  "main": "app.js",
  "scripts": {
    "lint": "eslint --ext .js,.ts --ignore-path .gitignore ."
  },
  "dependencies": {
    "node-fetch": "^2.7.0"
  },
  "devDependencies": {
    "@types/homey": "npm:homey-apps-sdk-v3-types@^0.3.12",
    "eslint": "^7.32.0",
    "eslint-config-athom": "^3.1.5"
  }
}

That app.json looks normal, node-fetch should work though I’ve never used it (I use axios for my own apps). Have you installed the latest NodeJS version on your PC?

Also, AFAIK fetch is included by default on newer NodeJS versions so you can try removing the dependency as well

Wait… i had an entry

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

in there before which I initially thought was the culprit and was removed.

But when going over the other JSON files I noticed this was in my package-lock.json:

  "packages": {
    "": {
      "name": "nl.creitive.enlighten",
      "version": "1.2.0",
      "dependencies": {
        "node-fetch": "^2.7.0"
      },
      "devDependencies": {
        "@types/homey": "npm:homey-apps-sdk-v3-types@^0.3.12",
        "eslint": "^7.32.0",
        "eslint-config-athom": "^3.1.5"
      },
      "engines": {
        "node": ">=16.0.0"
      }
    },

An ‘empty’ (?) entry that still has the engines->node spec.

@Peter_Kawa this empty entry is missing completely from the package-lock.json in that version we (you) got ‘accidentally’ running.

That means “higher than or equal to”, so it shouldn’t be an issue. Can you try to remove that engines part from your package.json anyway? I don’t think it will fix anything though. Package-lock is also not needed for the app to function, you can delete it and run npm update to generate a new one if it somehow got corrupted. As long as you don’t delete package.json, you should be fine.

And can you share your .homeycompose/app.json as well?

Yeah but the Homey 2019 is running nodejs 12 (which I also find odd…).

I’m a long time developer, but fairly new to the npm stuff :sweat_smile:
The package-lock.json indeed shouldn’t be a problem.

Here’s the app.json:

{
  "id": "nl.creitive.enlighten",
  "version": "1.2.1",
  "compatibility": ">=10.0.0",
  "sdk": 3,
  "runtime": "nodejs",
  "brandColor": "#f0b400",
  "platforms": [
    "local"
  ],

(ommited the name/tags/description/etc)

To make things even more odd: Homey apps run in a different Node.js version. I can’t remember which one and can’t check because my P-o-S HP2019 refuses to come back to life (even though it’s pinging, both the CLI tool and the dev tools claim it’s offline…)

Try to change compatibility to >=12.9.0

Yes, but as of Homey version 12.9.0, NodeJS versions are the same across both first and second generation Homeys

Indeed, it’s using v22.20.0 for apps.

We did some tests with different compatibility versions I believe. But now i’m not so sure, as we were messing with that engines entry also…

We’ll try! Pinging @Peter_Kawa (as I dont have a HP2019 myself).

Have you tried deleting package-lock.json and creating a new one with npm update as well? I use a Pro 2019 and have developed many apps but I’ve never seen this error before.

Do you also have a GitHub repo?

Not yet; it’s on the list.

I can’t really try the stuff quickly myself, as I don’t have a HP2019. I sent Peter_Kawa the source code and he’s been trying stuff. The odd thing he had a working version at one point but was not sure what exactly was changed in that version.

He did send me that version back and it has "compatibility": ">=12.0.0",

I will test node-fetch on my Homey Pro 2019, since I think the issue might be there in that dependency. AFAIK you can also just remove node-fetch altogether, it’s built in to recent NodeJS versions anyway

Strange, I don’t get that error (even with the engines property set and node-fetch@2.7.0 installed). Have you updated the Homey CLI to the latest version with npm i -g homey?

And with "compatibility": ">=10.0.0"?
Thanks for testing! Appreciate the back-and-forth!

I also don’t get that error with compatibility set to >=10.0.0. have you updated the CLI to the latest version?