Julusian / node-elgato-stream-deck

A Node.js library for interfacing with the Elgato Stream Deck. https://julusian.github.io/node-elgato-stream-deck/
https://www.npmjs.com/org/elgato-stream-deck
MIT License
159 stars 22 forks source link

npm install failure #45

Closed cwilling closed 2 years ago

cwilling commented 2 years ago

npm install fails at postinstall (as below). I'm using nodejs 12 but same problem with 14, 16 & 18. Any tips to fix?

npm install says:

> elgato-stream-deck-packages@0.0.0 postinstall /home/chris/src/node-elgato-stream-deck
> lerna bootstrap

lerna notice cli v4.0.0
lerna info bootstrap root only
lerna ERR! yarn install --mutex network:42424 --non-interactive exited 2 in 'elgato-stream-deck-packages'
lerna ERR! yarn install --mutex network:42424 --non-interactive exited 2 in 'elgato-stream-deck-packages'
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! elgato-stream-deck-packages@0.0.0 postinstall: `lerna bootstrap`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the elgato-stream-deck-packages@0.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/chris/.npm/_logs/2022-05-17T23_15_07_395Z-debug.log

The debug log says:

44350 info lifecycle elgato-stream-deck-packages@0.0.0~postinstall: elgato-stream-deck-packages@0.0.0
44351 verbose lifecycle elgato-stream-deck-packages@0.0.0~postinstall: unsafe-perm in lifecycle true
44352 verbose lifecycle elgato-stream-deck-packages@0.0.0~postinstall: PATH: /home/chris/.nvm/versions/node/v12.22.12/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/chris/src/node-elgato-stream-deck/node_modules/.bin:/home/chris/.nvm/versions/node/v12.22.12/bin:/home/chris/gowork/bin:/usr/local/sage/bin:/home/chris/bin:/usr/sbin:/sbin:/usr/lib64/go1.17.9/go/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/libexec/kf5:/usr/lib64/libreoffice/program:/usr/lib64/qt5/bin:/usr/lib64/zulu-openjdk11/bin:/home/chris/.platformio/penv/bin:/opt/crosstool-ng/bin
44353 verbose lifecycle elgato-stream-deck-packages@0.0.0~postinstall: CWD: /home/chris/src/node-elgato-stream-deck
44354 silly lifecycle elgato-stream-deck-packages@0.0.0~postinstall: Args: [ '-c', 'lerna bootstrap' ]
44355 silly lifecycle elgato-stream-deck-packages@0.0.0~postinstall: Returned: code: 2  signal: null
44356 info lifecycle elgato-stream-deck-packages@0.0.0~postinstall: Failed to exec postinstall script
44357 verbose stack Error: elgato-stream-deck-packages@0.0.0 postinstall: `lerna bootstrap`
44357 verbose stack Exit status 2
44357 verbose stack     at EventEmitter.<anonymous> (/home/chris/.nvm/versions/node/v12.22.12/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
44357 verbose stack     at EventEmitter.emit (events.js:314:20)
44357 verbose stack     at ChildProcess.<anonymous> (/home/chris/.nvm/versions/node/v12.22.12/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
44357 verbose stack     at ChildProcess.emit (events.js:314:20)
44357 verbose stack     at maybeClose (internal/child_process.js:1022:16)
44357 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
44358 verbose pkgid elgato-stream-deck-packages@0.0.0
44359 verbose cwd /home/chris/src/node-elgato-stream-deck
44360 verbose Linux 5.15.38
44361 verbose argv "/home/chris/.nvm/versions/node/v12.22.12/bin/node" "/home/chris/.nvm/versions/node/v12.22.12/bin/npm" "install"
44362 verbose node v12.22.12
44363 verbose npm  v6.14.16
44364 error code ELIFECYCLE
44365 error errno 2
44366 error elgato-stream-deck-packages@0.0.0 postinstall: `lerna bootstrap`
44366 error Exit status 2
44367 error Failed at the elgato-stream-deck-packages@0.0.0 postinstall script.
44367 error This is probably not a problem with npm. There is likely additional logging output above.
44368 verbose exit [ 2, true ]
Julusian commented 2 years ago

I know it works with yarn, npm probably isn't happy because of how lerna is setup.

This only matters for development, not when installing packages from npm

cwilling commented 2 years ago

OK thanks - I'm not very familiar with yarn but running yarn build seemed to finish without incident and some of the examples work. However they seem to be looking in the wrong directory for images e.g.`

(node:118435) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/home/chris/src/node-elgato-stream-deck/packages/node/src/__tests__/fixtures/mosaic.png'

In that particular case, changing the path from path.resolve(__dirname, '../src/__tests__/fixtures/mosaic.png') to path.resolve(__dirname, '../../../fixtures/mosaic.png') enabled images to load and be displayed. Is that possibly because some additional yarn command is required to move images into the correct directory?

The reason to know is that I may want to build on other architectures not supported by prebuilt npm packages. Also, I just like to know :)

Julusian commented 2 years ago

I have a feeling that I never did get around to updating some of the examples when restructuring files, so it is very possible that some are a bit broken.

The reason to know is that I may want to build on other architectures not supported by prebuilt npm packages. Also, I just like to know :)

Nothing in this library is architecture specific. Some of the dependencies (node-hid and @julusian/jpeg-turbo) are native libraries and where you might need to focus. Do you have any idea what architectures you might be needing? I believe they both already support the common ones

Julusian commented 2 years ago

I have a feeling that I never did get around to updating some of the examples when restructuring files, so it is very possible that some are a bit broken.

The reason to know is that I may want to build on other architectures not supported by prebuilt npm packages. Also, I just like to know :)

Nothing in this library is architecture specific. Some of the dependencies (node-hid and @julusian/jpeg-turbo) are native libraries and where you might need to focus. Do you have any idea what architectures you might be needing? I believe they both already support the common ones

cwilling commented 2 years ago

Aiming to eventually run on anything including RASPI armhf & arm64 and thought I'd need to rebuild for node-hid at least.

I just built on armhf RASPI and it seemed to go OK. Rapid-fill & brightness examples run fine but bit of a problem with device-detection which is stuck at:

 pi@pi4b2:~/node-elgato-stream-deck/packages/node/examples $ node device-detection.js 
{ model: 'xl', path: '/dev/hidraw0', serialNumber: 'CL29K1A00610' }
Serial: Promise { <pending> }
Firmware: Promise { <pending> }

The same device attached to a regular x86_64 machine gave a full report without stalling like that.

I'll look at it some more tomorrow (it's late here now).

Julusian commented 2 years ago

That output looks mostly correct, other than it wasnt updated for the api changes to handle those functions becoming promises.

yeah node-hid doesnt look to have a linux-arm64 build currently, but also if you have the correct build tools installed it will happily build it when being installed as a dependency. Ive opened an issue to ask for it, as I too do use node-hid on arm64, but didnt notice the lack of prebuilt binary.

Julusian commented 2 years ago

I have tested and updated the examples

cwilling commented 2 years ago

Thanks. I can confirm that the examples (including device-detection.js) now work as expected on RASPI - both armhf and arm64.