AlexGustafsson / homebridge-wol

A Wake on Lan plugin for Homebridge
MIT License
301 stars 30 forks source link

Build failure #138

Closed conao3 closed 3 years ago

conao3 commented 3 years ago

Backstory

I want to investigate and contribute this plugin, I want to run this plugin locally.

Issue

npm ci to resolve dependency using your package.lock and npm run build shows error.

Environment

Log

When I follow these steps:

  1. git clean
  2. npm ci
  3. npm run build

I get the following log:

$ git clean -fdx
Removing dist/

$ npm ci
added 170 packages in 5.65s

$ npm run build

> homebridge-wol@5.0.0-beta.1 build /home/conao/dev/forks/homebridge-wol
> tsc

src/config.ts:117:56 - error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'string | NetworkDeviceLogLevel'.
  Type 'unknown' is not assignable to type 'NetworkDeviceLogLevel.None'.

117     if (!Object.values(NetworkDeviceLogLevel).includes(config[key]))
                                                           ~~~~~~~~~~~

Found 1 error.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! homebridge-wol@5.0.0-beta.1 build: `tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the homebridge-wol@5.0.0-beta.1 build 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/conao/.npm/_logs/2021-02-06T19_15_49_259Z-debug.log
$ cat ~/.npm/_logs/2021-02-06T19_15_49_259Z-debug.log 
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/home/conao/.anyenv/envs/nodenv/versions/14.13.0/bin/node',
1 verbose cli   '/home/conao/.anyenv/envs/nodenv/versions/14.13.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build'
1 verbose cli ]
2 info using npm@6.14.8
3 info using node@v14.13.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle homebridge-wol@5.0.0-beta.1~prebuild: homebridge-wol@5.0.0-beta.1
6 info lifecycle homebridge-wol@5.0.0-beta.1~build: homebridge-wol@5.0.0-beta.1
7 verbose lifecycle homebridge-wol@5.0.0-beta.1~build: unsafe-perm in lifecycle true
8 verbose lifecycle homebridge-wol@5.0.0-beta.1~build: PATH: /home/conao/.anyenv/envs/nodenv/versions/14.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/conao/dev/forks/homebridge-wol/node_modules/.bin:/home/conao/.anyenv/envs/nodenv/versions/14.13.0/bin:/home/conao/.anyenv/envs/nodenv/libexec:/home/conao/.anyenv/envs/nodenv/plugins/nodenv-vars/bin:/home/conao/.anyenv/envs/nodenv/plugins/nodenv-default-packages/bin:/home/conao/.anyenv/envs/nodenv/plugins/node-build/bin:/home/conao/go/1.15.2/bin:/home/conao/.anyenv/envs/pyenv/shims:/home/conao/.anyenv/envs/pyenv/bin:/home/conao/.anyenv/envs/nodenv/shims:/home/conao/.anyenv/envs/nodenv/bin:/home/conao/.anyenv/envs/goenv/shims:/home/conao/.anyenv/envs/goenv/bin:/home/conao/.roswell/bin:/home/conao/.local/bin:/home/conao/bin:/home/conao/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin
9 verbose lifecycle homebridge-wol@5.0.0-beta.1~build: CWD: /home/conao/dev/forks/homebridge-wol
10 silly lifecycle homebridge-wol@5.0.0-beta.1~build: Args: [ '-c', 'tsc' ]
11 silly lifecycle homebridge-wol@5.0.0-beta.1~build: Returned: code: 2  signal: null
12 info lifecycle homebridge-wol@5.0.0-beta.1~build: Failed to exec build script
13 verbose stack Error: homebridge-wol@5.0.0-beta.1 build: `tsc`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/home/conao/.anyenv/envs/nodenv/versions/14.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (/home/conao/.anyenv/envs/nodenv/versions/14.13.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1047:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid homebridge-wol@5.0.0-beta.1
15 verbose cwd /home/conao/dev/forks/homebridge-wol
16 verbose Linux 5.10.7-3-MANJARO
17 verbose argv "/home/conao/.anyenv/envs/nodenv/versions/14.13.0/bin/node" "/home/conao/.anyenv/envs/nodenv/versions/14.13.0/bin/npm" "run" "build"
18 verbose node v14.13.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 2
22 error homebridge-wol@5.0.0-beta.1 build: `tsc`
22 error Exit status 2
23 error Failed at the homebridge-wol@5.0.0-beta.1 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
AlexGustafsson commented 3 years ago

Interesting. I wasn't able to replicate this at first, but after I removed node_modules and re-ran npm install and npm run build, sure enough, the compiler catches this. It's likely that TypeScript has been updated to catch this issue.

I'll take a look at your PR, but keep this open until we've found a good fix.

AlexGustafsson commented 3 years ago

Your PR solved the issue properly and has now been merged.

conao3 commented 3 years ago

Good, thanks for developing this plugin!