gabriele-v/hubitat

Cant get this to install and run on Ubuntu 18.04 LTS - npm install fails

Opened this issue · 7 comments

I've tried multiple versions of node.js (10, 12, 14) and all of them throw the following errors when you run "npm install":

319 verbose stack Error: spawn git ENOENT
319 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
319 verbose stack     at onErrorNT (internal/child_process.js:469:16)
319 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:84:21)
320 verbose cwd /home/derek/AlexaTTS
321 verbose Linux 5.4.0-42-generic
322 verbose argv "/usr/bin/node" "/usr/bin/npm" "install"
323 verbose node v12.18.3
324 verbose npm  v6.14.6
325 error code ENOENT
326 error syscall spawn git
327 error path git
328 error errno ENOENT
329 error enoent Error while executing:
329 error enoent undefined ls-remote -h -t ssh://git@github.com/Apollon77/alexa-cookie.git
329 error enoent
329 error enoent
329 error enoent spawn git ENOENT
330 error enoent This is related to npm not being able to find a file.
331 verbose exit [ 1, true ]

As a result, it never works (no web ui on specified ports) even tho the next few steps appear to complete successfully. Im running my install as root (sudo -i).

Stupid question. Do you have git installed? That was my issue.

I dont believe so:

root@Enterprise:~# git --version

Command 'git' not found, but can be installed with:

apt install git

root@Enterprise:~# 

Looking at the current package file:

{
  "name": "alexa-cookie-node",
  "version": "0.1.2",
  "description": "AlexaCookieNodeJs",
  "main": "AlexaCookie.js",
  "author": "",
  "dependencies": {
    "alexa-cookie2": "github:Apollon77/alexa-cookie",
    "body-parser": "^1.18.3",
    "cookie": "^0.3.1",
    "express": "^4.16.4",
    "http": "0.0.0",
    "http-proxy-middleware": "^0.19.1",
    "http-proxy-response-rewrite": "0.0.1",
    "linkifyjs": "^2.1.7",
    "querystring": "^0.2.0",
    "socket.io": "^2.2.0",
    "uuid": "^3.3.2"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "license": "Apache-2.0"
}

this appears to be the culprit. I'm going to try replacing it with:

https://github.com/Apollon77/alexa-cookie

Ok the above URL didnt change the outcome:

root@Enterprise:/home/derek/AlexaTTS# npm install
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 ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/Apollon77/alexa-cookie.git
npm ERR! enoent 
npm ERR! enoent 
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-09-02T03_17_50_190Z-debug.log
root@Enterprise:/home/derek/AlexaTTS# 

Ok, to rule out my Ubuntu server as the issue, I've run this on my Synology NAS and got the exact same issues. I used both the options described above with the same result:

github:Apollon77/alexa-cookie
https://github.com/Apollon77/alexa-cookie

root@DiskStation:/volume1/alexa# npm install
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 ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/Apollon77/alexa-cookie.git
npm ERR! enoent 
npm ERR! enoent 
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-09-02T03_39_00_697Z-debug.log
root@DiskStation:/volume1/alexa# 

I copied the alexa-cookie folder into my AlexaCookie Node JS folder and change the line:

"alexa-cookie2": "github:Apollon77/alexa-cookie",

to

"alexa-cookie2": "/volume/alexa/AlexaCookie/alexa-cookie",

and it finally worked on node.js v12 on my NAS.

i also had to add the following line to AlexaCookie.js to support Australia:

<input type="radio" name="amazonSite" value="alexa.amazon.com.au|en-AU"> Australia<br>

I copied the alexa-cookie folder into my AlexaCookie Node JS folder and change the line:
"alexa-cookie2": "github:Apollon77/alexa-cookie",
to
"alexa-cookie2": "/volume/alexa/AlexaCookie/alexa-cookie",
and it finally worked on node.js v12 on my NAS.

@dJOS1475 I was going down a very similar path, but your local alexa-cookie path saved me! Thank you!!