empierre / MyDomoAtHome

MyDomoAtHome - REST interface for ImperoHome with Domoticz (ISS)
http://domoticz.com/wiki/ImperiHome
GNU General Public License v3.0
31 stars 22 forks source link

Windows 10 failure #198

Closed sundansx closed 10 months ago

sundansx commented 2 years ago

Trying to run the newest mydomoathome on win7 and getting this error. mydomoathome 0.2.39 runs fine on the same system/node version. Any idea what's could be causing this? note: xxx's for privacy.

info: Domoticz server: http://xxxxxxxxxxxxxxx/json.htm info: Node version: 12.19.0 info: MDAH version: MyDomoAtHome 0.2.41 info: OS version: Windows_NT win32 6.1.7601 (windows7) info: Hostname: webserver xxxxx in C:\Users\xxxx C:\utils\nodejs-apps\MyDomoAtHome-nodejs events.js:291 throw er; // Unhandled 'error' event ^

Error: spawn npm ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) Emitted 'error' event on ChildProcess instance at: at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) { errno: 'ENOENT', code: 'ENOENT', syscall: 'spawn npm', path: 'npm', spawnargs: [ '-v' ] }

empierre commented 2 years ago

looks you don't have npm on tbe machine?

Le sam. 8 janv. 2022, 09:48, sundansx @.***> a écrit :

Trying to run the newest mydomoathome on win7 and getting this error. mydomoathome 0.2.39 runs fine on the same system/node version. Any idea what's could be causing this? note: xxx's for privacy.

info: Domoticz server: http://xxxxxxxxxxxxxxx/json.htm info: Node version: 12.19.0 info: MDAH version: MyDomoAtHome 0.2.41 info: OS version: Windows_NT win32 6.1.7601 (windows7) info: Hostname: webserver xxxxx in C:\Users\xxxx C:\utils\nodejs-apps\MyDomoAtHome-nodejs events.js:291 throw er; // Unhandled 'error' event ^

Error: spawn npm ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) Emitted 'error' event on ChildProcess instance at: at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) { errno: 'ENOENT', code: 'ENOENT', syscall: 'spawn npm', path: 'npm', spawnargs: [ '-v' ] }

— Reply to this email directly, view it on GitHub https://github.com/empierre/MyDomoAtHome/issues/198, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXTDCSYVZUQGD22EDOMH4LUU726XANCNFSM5LQMB2SQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

sundansx commented 2 years ago

empierre, thanks for responding. Here is what I get when I type 'npm' on the command line: C:\utils\nodejs-apps\MyDomoAtHome-nodejs>npm -v 6.14.8

is the syscall 'spawn npm' a newer addiition? because domoathome 0.2.39 works fine. Here is the log when I did a "npm install' on the 0.2.41 release: xxxx>npm install npm WARN deprecated istanbul@0.3.22: This module is no longer maintained, try this instead: npm WARN deprecated npm i nyc npm WARN deprecated Visit https://istanbul.js.org/integrations for other alternatives. npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.) npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies . npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"an y"} (current: {"os":"win32","arch":"x64"}) npm WARN notsup Unsupported engine for superagent@7.0.1: wanted: {"node":">=6.4.0 !13"} (current: {"node":"12.19.0","npm ":"6.14.8"}) npm WARN notsup Not compatible with your version of node/npm: superagent@7.0.1

added 817 packages from 1032 contributors and audited 819 packages in 18.433s

56 packages are looking for funding run npm fund for details

found 13 vulnerabilities (10 moderate, 3 high) run npm audit fix to fix them, or npm audit for details

sundansx commented 2 years ago

I found the cause of this - it involves a long known crossplatform bug on node.js. It looks like the addition of the ability of mdah to query npm version broke cross platform compatibility at some point. There are a few solutions to use. I went with adding the node module 'cross-spawn' lib and then making a change to mdah.js. This fix should be cross-platform compatible:

  1. 'npm install cross-spawn'
  2. change mdah.js: remove: 2758: const { spawn } = require("child_process"); add: 2758: const spawn = require('cross-spawn');
sundansx commented 2 years ago

followup note on this: the reason it broke is "npm" is implemented as a batch script named "npm.cmd" on Windows and the regular jscript spawn does not find things in the path other than '.exe' files.