uhop / node-re2

node.js bindings for RE2: fast, safe alternative to backtracking regular expression engines.
Other
495 stars 53 forks source link

Platform Specific Build is Not Downloaded #91

Closed clehnert-wfw closed 3 years ago

clehnert-wfw commented 3 years ago

I am on a Windows machine trying to download the Linux distribution of metascraper using the following npm install command:

npm install --arch=x64 --platform=linux metascraper

This seems to work just fine.

Somewhere down the dependency line, re2 is installed however, instead of installing the linux version (which I do see on your release page) I get the Windows version. This breaks my code (AWS Lambda). I have tried doing an re2 install afterwards (npm install --arch=x64 --platform=linux re2) but I still only get the Windows build.

How can I download and install the Linux version?

Thanks

uhop commented 3 years ago

AFAIK, node binary extensions do not support cross compilation.

If you want to skip downloading a precompiled version, just define an environment variable DEVELOPMENT_SKIP_GETTING_ASSET with any non-empty value. please let me know if it helped.

uhop commented 3 years ago

BTW, what is the source of --arch=x64 --platform=linux? As far as I can tell it is not documented:

Likely it is specific to metascraper.

I do use AWS and build my code in a docker image running on a similar hardware. Sometimes the hardware should be identical to run-time because some processor-intensive packages (e.g., various compression utilities in my case) use a CPU-specific code generation. I believe that AWS Lambda is well documented and the best bet is to replicate its environment to do a build if possible.

clehnert-wfw commented 3 years ago

Ok. I think the problem is I assumed the --arch=x64 --platform=linux parameters were universal but they are not (I actually used them installing sharp). My bad. I guess will have to setup docker and run my builds from there.

Thanks for your help.

uhop commented 3 years ago

I'll copy the content of this ticket to the wiki.

uhop commented 3 years ago

Done: https://github.com/uhop/node-re2/wiki/Problem:-different-build-and-prod-environments