[Homey2019Pro] homey-zwavedriver not found?

Hi,

I’m updating my domitech app to the newest SDK3 and the homey-zwavedriver.
(Source code: GitHub - timkouters/nl.timkouters.domitech: This app adds support for Domitech devices in Homey.)

When I run this app on my HomeyPro early 2019 version I constantly get the error that the homey-zwavedriver cannot be found (see below).
Now the fun part, other user the do the checkout of the same code they can run the domitech app without any issues. These users are using the HomeyPro 2023 version.

Is there anything different between the 2019 and 2023 Pro version of Homey and should I therefor stick to the deprecated meshdriver?

Details of the crash:

timkouters@dev-TimKouters:~/github2/nl.timkouters.domitech$ homey app run
✓ Pre-processing app...
✓ Validating app...
✓ App validated successfully against level `debug`
✓ Packing Homey App...
 — App archive size: 153.5 KB, 15 files
✓ Installing Homey App on `Homey Pro van Tim` (http://10.0.0.232:80)...
✓ Homey App `nl.timkouters.domitech` successfully installed
✓ Running `nl.timkouters.domitech`, press CTRL+C to quit
 — Profile your app's performance at https://go.athom.com/app-profiling?homey=61276845aae08b0bb23bc2f3&app=nl.timkouters.domitech
─────────────── Logging stdout & stderr ───────────────
[log] 2023-06-20 17:00:11 [DomitechApp] Starting Domitech Z-Wave app
[err] 2023-06-20 17:00:11 [ManagerDrivers] [Driver:dtA19-750-27] Error Initializing Device: Error: Cannot find module 'homey-zwavedriver'
Require stack:
- /drivers/dtA19-750-27/device.js
- /opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/homey-apps-sdk-v3/lib/Util.js
- /opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/homey-apps-sdk-v3/lib/Device.js
- /opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/homey-apps-sdk-v3/homey.js
- /opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/homey-apps-sdk-v3/index.js
- /opt/homey-client/system/manager/ManagerApps/AppProcess/bootstrap.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at Module.require (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/homey-apps-sdk-v3/index.js:1:183)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/drivers/dtA19-750-27/device.js:3:25)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/drivers/dtA19-750-27/device.js',
    '/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/homey-apps-sdk-v3/lib/Util.js',
    '/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/homey-apps-sdk-v3/lib/Device.js',
    '/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/homey-apps-sdk-v3/homey.js',
    '/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/homey-apps-sdk-v3/index.js',
    '/opt/homey-client/system/manager/ManagerApps/AppProcess/bootstrap.js'
  ]
}

Who can help me out?

Kind regards,
Tim

✓ Packing Homey App...
 — App archive size: 153.5 KB, 15 files

The node_modules directory in your repo has many more files, so it’s not being uploaded to your Homey, likely because it’s mentioned in .homeyignore or .gitignore.

Hi Robert,

Thanks for the quick reply.
I’ve searched for the two files but they are not present on my local storage.

timkouters@dev-TimKouters:~/github2/nl.timkouters.domitech$ find . -name .gitignore
timkouters@dev-TimKouters:~/github2/nl.timkouters.domitech$ find . -name .homeyignore

I did read that for the new Homey CLI they excluded the node_modules.
See Developer's update: Homey SDK tools | Homey

Kind regards,
Tim

That’s not what that page says :slight_smile: Also, it’s a 3-year-old blog post.

But it does look like a local issue, the app installs just fine both on my HP2019 and HP2023:

✓ Packing Homey App...
 — App archive size: 838.5 KB, 242 files
✓ Installing Homey App on `Homey` (http://192.168.23.8:80)...
✓ Homey App `nl.timkouters.domitech` successfully installed
✓ Running `nl.timkouters.domitech`, press CTRL+C to quit
 — Profile your app's performance at https://go.athom.com/app-profiling?homey=XXX&app=nl.timkouters.domitech
─────────────── Logging stdout & stderr ───────────────
[log] 2023-06-21 03:55:00 [DomitechApp] Starting Domitech Z-Wave app

Does .homeybuild/node_modules contain the homey-zwavedriver module?

Do you have a .npmignore file?

Hi,

I also think it’s a local issue.

I do have .npmignore files but not in the homey-zwavedriver.
Furthermore, the .homeybuild does not contain any node_modules directory.

timkouters@dev-TimKouters:~/github2/nl.timkouters.domitech$ find . -name .npmignore
./node_modules/mumath/.npmignore
./node_modules/almost-equal/.npmignore
./node_modules/stack-trace/.npmignore
./node_modules/uuid/.npmignore
timkouters@dev-TimKouters:~/github2/nl.timkouters.domitech$ cd .homeybuild/
timkouters@dev-TimKouters:~/github2/nl.timkouters.domitech/.homeybuild$ ls
app.js    assets   LICENSE  package.json       README.md
app.json  drivers  locales  package-lock.json  README.txt

Update from my side.
If I manually copy the node_module folder to the .homeybuild directory and run the app with skipping the build all is working.

homey app run -s

The best way to debug this is to edit the file App.js in $PREFIX/lib/node_modules/homey/lib (where $PREFIX is the output of the command npm prefix, typically it’s /usr/local).

My guess is that the issue is happening somewhere in the _copyAppProductionDependencies method, so you should probably add a bunch of debug console.log() entries to see which steps it takes (and which it doesn’t).

Also, just in case: which version of homey do you have installed (homey --version)? The latest stable is 2.34.0.

Hi Robert,

I’m indeed running version 2.34.0 of Homey.
The issue is in the npm list . command.

timkouters@dev-TimKouters:~/github/nl.timkouters.domitech$ npm list .
nl.timkouters.domitech@2.0.0 /home/timkouters/github/nl.timkouters.domitech
└── (empty)

timkouters@dev-TimKouters:~/github/nl.timkouters.domitech$ npm list -g
/usr/local/lib
├── homey@2.34.0
└── npm@9.6.2

I’ve created a VM at my other PC with a new linux distro install.
There I get proper output of ‘npm list .’

I’m going to re-install my laptop.

Thanks for helping me out.

Kind regards,
Tim

I don’t see homey running that command, it runs:

npm ls --parseable --all --only=prod

(passing . is incorrect as argument as it requires a package spec, not a directory name)