prebuild-install
prebuild-install copied to clipboard
How to fail completely via flags if the remote isn't available
I'd like to test if the download works. With node-pre-gyp
I was able to install the package like so and ensure it downloaded and not built.
npm install serialport@beta --fallback-to-build=false
I use this in CI to ensure the state of all the builds before publishing the npm package. It's also been able to catch npm bugs on different platforms. It has been very helpful.
Since my package.json install line now reads
"install": "prebuild-install || node-gyp rebuild",
I need to convince prebuild-install
to not download and not error, or convince node-gyp
to not build if it gets run.
Is there a known way to achieve this?
Thanks!
No, this is currently not possible. The standalone check was implemented as a little help for the module developers, so they don't have to specify --build-from-source
every time they want to build their modules.
@ralphtheninja I see two options here:
- remove the standalone path (major)
- add a new argument for this case like
--force-download
that skips the standalone check (minor).
I am tending to 1 because prebuild-install
was made to download the binary. And it should only exit if a user don't want to or a download is not possible. And for developer there are still two aliases for --build-from-source
--compile
and -c
wich should be documented :)
I need to convince prebuild-install to not download and not error, or convince node-gyp to not build if it gets run.
I was a bit confused by this. If I understand correctly, you want prebuild-install
to download and if that fails it should fail?
How about adding prebuild-install --test
instead, you could then have a pretest
script that's being run when testing (or add another script and execute it explicitly in e.g. .travis.yml)
@mathiask88 What do you mean with "the standalone path"?
@ralphtheninja I meant this behavior.
I think the --test
flag would need to process.exit(0)
to prevent the binary from being built from node-gyp
with the recommended setup.
Unless --test
would be used for testing to see if it could download the package and not actually installing the binary?
I'd prefer to keep this in the install processes so I can verify that not only it downloaded but the download works.
eg
npm install --prebuild-test
node ./ # Would fail if binary isn't present
Funny enough this works on linux, false
takes any argument and fails
node-gyp rebuild --make=false
but I don't know how to pass it through npm install
Oh, ok I misread. I thought you want to download the binary in your dev environment, ignore my last answer then :)
Oh, ok I misread. I thought you want to download the binary in your dev environment, ignore my last answer then :)
This is my current understanding as well :)
@reconbot Is this still a thing?
Yeah, unless there's been new features I don't know about. This allows me to test our build pipeline and ensure we have binaries published and useable without having to build something to test prebuild-install.