empierre / MyDomoAtHome

MyDomoAtHome - REST interface for ImperoHome with Domoticz (ISS)

Home Page:http://domoticz.com/wiki/ImperiHome

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows 10 failure

sundansx opened this issue · comments

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, 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 request/request#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

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');

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.