node_sleep.node is macOS only binary
vineetgupt opened this issue ยท 13 comments
I am trying to run your tool on Linux, and getting following error, presumably due to node_sleep.node being macOS only binary-
module.js:681
return process.dlopen(module, path._makeLong(filename));
^
Error: /home/vineet/bin/delivery-finder/node_modules/sleep/build/Release/node_sleep.node: invalid ELF header
at Object.Module._extensions..node (module.js:681:18)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/vineet/bin/delivery-finder/node_modules/sleep/index.js:1:75)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
I am not familiar with node.js, but isn't this something which can be pulled as dependency, instead of committing to the repo?
I deleted node_modules, and ran npm install
in the root of the project. It pulls dependencies and compiles as needed. However, when I try to run tool again, I am seeing this error:
delivery-finder$ node finder.js -amazonwholefoods
Starting the Delivery finder for Amazon Whole Foods with this configuration:
----------------------------------------------------------------------------------
URL =====> https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1
checkingInEveryXminutes =====> 1 minute(s)
Cookie =====> ubid-main=133-5194402-6850444; lc-main=en_US; _sdsat_custID=amzn1.account.AFBNCY6MMYLKNQZVJIULUYDBNR6Q; AMCV_69C78985561E42B67F000101%40AdobeOrg=283337926%7CMCIDTS%7C17856%7CMCMID%7C04450025021841975318718113724127743459%7CMCAAMLH-1543300651%7C9%7CMCAAMB-1543300651%7CRKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y%7CMCAID%7CNONE; aws-priv=eyJ2IjoxLCJldSI6MCwic3QiOjB9; aws-target-static-id=1542698515766-69405; s_fid=5DC1EF403DD8D3EC-26B928CAD905535D; regStatus=pre-register; x-wl-uid=1QpQaVsZY+IHmw3u2VGtNYVzhJ4b/mz/D5RJ+CkMLmJ+xOkKMdo9DZcU7j1MdjSXiCS+iulVj+w9AH8Qj+TfNCPBdFvJYEq0CGiN1MqwlRB699jSqx/UD926iM9MnKgp6UnYQY5BVRqo=; unique_id=MFOq8fQqkZA0a4NwRqh1sJhk1B89lglD; skin=noskin; s_cc=true; sst-main=Sst1|PQHTFrAMkb9P2OzFCrkPdi6JC9AMUeSIYTcy_gjWZ42911fcNdbkN01GgRzGBnk7Qdd94nZsmf0Tq4QAIYEz0R_MY12rkSqJgIt7u53djUe1MN7jZfAuBiP5aT76tGHOkDMSrltzD4wOwQ--qNQkd0zxLlHE2oRpHPkoGZx73tlKBow-TMnSZTpN9LDOd-DbKsaZABoM0Hh0ICcE4Ii63PA6z_hg5ZHf0qseHGC4637ZgL0vxPIq2wWP-7q8SbEzxAMDUw2FZTW2zIsATbIcEKJQuEQkDfDr5VknSidXXw4J_-UmpVaUidOwgMvEYBHdQE5Y9cLMMxPl745Na4uO-dq3jw; s_sq=%5B%5BB%5D%5D; s_ppv=28; session-id=138-6919253-5455520; i18n-prefs=USD; x-main="NqRfSHDYtLYAGcyFnJu2cBqsRTr?BSyvzgbAZkM4W0SAwJU0LOLvAOPvAjbTifMF"; at-main=Atza|IwEBICCa4nC7nnFma7a7sYh35vIIidtK_PvK4JJ-y23AFHnBEsCRosz6Rl-X2Mj88_7aZJb18aZkCBKepiZrv17K8yGsY9AD2j4U30e72Y1gx1OshpZJ7WUo8Qm0Q3YG3llHp1XQ14p3zN99IxJgxtVjK1mxTqwbR_WAhy2IS7elEUudYS7zq-D0H6kypyXLBMESAm3zqSSfzb9jRIfIsSil5IBPNE6Mt2mEdorQLSUO4IB2JQn3SwoXxRWvqEOL9CVsZOW4UoU2vMqwOXB7lAy52LeCs4Vf-MGH7M-c3yUmStqk41dZJhaLZXDUgJ2DoStKGKmXH_4Es8b84bOSVeZLnGIFWLElybias4nYlqgqSc9JdgysGnB7ZbwbLk7vg4IyxdNCzwcsM_88gZbtLuprNpmE; sess-at-main="irbDfBU6sMe+xySyZENKG2wSzH39U6/yf8kX2YHD7LA="; session-id-time=2082787201l; session-token="ap/SQXAfXMB0WhiL3sW+IREleht3P4hUQafskW8I4I6b6dQNkWv30y5FgO1eM5QwcOMAg+CASIpZiVVz6beC+Lmcitdte5m2snGmj+KcYErT9JeN6CcBgM0DthuOokLvBQCb0HV/tB9mvd3Nvt7a6MUeM7XxNDeCwjLeaxhQHVQuqE9LXbFC41YAaiwF2GSiBcgPxxnb4+bZq/aEwuLmOHtv+RMW9n8YQhFlL2Msuv0VM69zLsLOcVqLm/TvR5LSFXfWMMv6UkhNfQBeTk6sRg=="; csm-hit=tb:0A38PZGKWVQJXGV10DTD+s-DZW9N99YDSE9FCN8EW85|1586846848401&t:1586846848401&adb:adblk_no
----------------------------------------------------------------------------------
events.js:340
throw new TypeError('"listener" argument must be a function');
^
TypeError: "listener" argument must be a function
at ClientRequest.once (events.js:340:11)
at new ClientRequest (_http_client.js:164:10)
at Object.request (http.js:38:10)
at Object.request (https.js:239:15)
at Object.get (https.js:243:21)
at pingRetailer (/home/vineet/bin/delivery-finder/finder.js:106:21)
at Object.<anonymous> (/home/vineet/bin/delivery-finder/finder.js:190:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
@vineetg I am sure, I can find a workaround. I will try to fix the code as soon as I get a chance.
@dishant and @parikhv15 - In the mean time, if you guys have any idea, then feel free to suggest.
@jvkumar Seems like committing node_modules into the repository isn't something standard. Due to this, the binaries generated are specific to macOS you are using. Alternative is to ask user to run npm install
and remove the directory altogether.
Another idea is to provide binaries for different OS, which can be executed right-away. Downloading node.js for end-user is anyway painful. This project https://github.com/zeit/pkg can be used to create downloadable binaries. Seems like it cross-compiles as well.
@vineetg yes you are right and I forgot to remove package-lock.json as well as node_modules folder. It is in .gitignore though.
Even after fixing it, I am getting error as per my this comment #31 (comment)
$ node -v
v8.10.0
$ npm -v
3.5.2
Thanks Vineet! I see that this is not compatible with Node 8. There is a breaking change in https
library of node from v8 to v10. Https.get
has 2 params in v8, while 3 params starting from v10. We can push changes to support for v8 as well, but it is recommended to upgrade node version to 10+. Starting 2020, Nodejs have removed support for v8.
cc: @jvkumar
Thanks for the investigation @parikhv15
Unfortunately, I don't know how many people are on node version <10 who are using this script.
If there are enough numbers of folks experiencing the same issue, then we may try to make it backward compatible. So far no one notified me about this issue.
@vineetg - can you try upgrading your node version, if possible?
@jvkumar Seems like committing node_modules into the repository isn't something standard. Due to this, the binaries generated are specific to macOS you are using. Alternative is to ask user to run
npm install
and remove the directory altogether.Another idea is to provide binaries for different OS, which can be executed right-away. Downloading node.js for end-user is anyway painful. This project https://github.com/zeit/pkg can be used to create downloadable binaries. Seems like it cross-compiles as well.
@vineetg Cleaned up the repo. Now you can install newer version with running npm install
@vineetg - did u upgrade to node >=10 and tried after that?
Yes, it works after upgrade. Thanks.
As there is no binary committed to code base, this issue is no longer relevant. I checked that instructions now include step of npm install
which would pull all dependencies. Hence closing this issue.