WonderInventions / node-webrtc

node-webrtc is a Node.js Native Addon that provides bindings to WebRTC M98
Other
109 stars 8 forks source link

Error during installation/building #14

Closed mat-sz closed 2 months ago

mat-sz commented 4 months ago

Problem description:

Installation of the package results in the following error:

➤ YN0007: │ @roamhq/wrtc@npm:0.7.3 must be built because it never has been before or the last one failed
➤ YN0009: │ @roamhq/wrtc@npm:0.7.3 couldn't be built successfully (exit code 127, logs can be found here: /see-below)

The build log looks as follows:

# This file contains the result of Yarn building a package (@roamhq/wrtc@npm:0.7.3)
# Script name: postinstall

command not found: patch-package

Attempted resolution steps:

Installing the patch-package package does not resolve the issue on my end. I believe this only happens when there are no prebuilt binaries available.

Proposed solution:

I think including patch-package in dependencies would resolve the issue. (or reconsidering whether patch-package is necessary at all)

System information:

Arch Linux, kernel version: 6.8.7
CPU architecture: x64
npm version: 10.5.2
yarn version: 4.0.2
node version: 21.7.3
duvallj commented 4 months ago

It seems you're on linux-x64, so uou should have available binaries (see the table), making me believe this is happening because Yarn runs the postinstall script even when this is installed as a dependency, whereas NPM does not.

patch-package is necessary for my usecase (there's an incompatibility in cmake-js on Windows that's a bit weird to upstream), but I concur the usecase is niche. It and cmake-js need to remain in the devDependencies because they should not be installed unless trying to build from source. I'll make a change to not make it a postinstall script (instead something like "patch" that Windows users can run (really the Windows build is much harder than this so I don't know why I bother)), should be fixed in the next release 👍

duvallj commented 2 months ago

@mat-sz I've since released 0.8.0 which no longer includes the problematic postinstall script. Does this fix the issue for you?

mat-sz commented 2 months ago

@duvallj Yep, everything works perfectly fine now. Thank you, great work!