This was first mentioned in https://github.com/Financial-Times/polyfill-service/pull/1397.
Upon npm run start, I receive Error: Cannot find module './build/bindings/iltorb.node'
For future issue-havers, please post these details:
node -vnpm -vlsb_release -auname -apython --versiongcc --versionMy environment:
v9.2.05.5.1Ubuntu 16.04.2 LTSLinux Exordium 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/LinuxPython 2.7.12(Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609My kernel version looks funky because I'm running Windows Subsystem for Linux.
Got it to work. I needed to run npm i in
node_modules/iltorbnode_modules/node-zopfliWhich compiled their bindings.
Should this have happened automatically, or should this extra build step be added to the documentation?
Yes, npm should automatically build these during the installation. I'm not sure why it would not do that, I've tried on my macbook using node 9 with npm 5 and it worked correctly.
Could you try installing node-pre-gyp first and then install polyfill-service please, I'm wondering whether we need to include this as a dependency in order to find the correct pre-built binaries instead of building them on your machine manually.
Huh. I just cleared out my node_modules, reinstalled with node-pre-gyp globally installed, and everything worked great. Then I cleared out node_modules again, reinstalled with node-pre-gyp uninstalled, and everything worked again. Strange.
However, both times, all attempts to fetch binaries failed, no attempt appears to have been made to fetch oniguruma's binaries:
node-pre-gyp ERR! Tried to download(403): https://node-zopfli.s3.amazonaws.com/Release/zopfli-v1.4.0-node-v59-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v59 ABI) (falling back to source compile with node-gyp)
...
prebuild-install http request GET https://github.com/MayhemYDG/iltorb/releases/download/v1.3.10/iltorb-v1.3.10-node-v59-linux-x64.tar.gz
prebuild-install http 404 https://github.com/MayhemYDG/iltorb/releases/download/v1.3.10/iltorb-v1.3.10-node-v59-linux-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=9.2.0 runtime=node arch=x64 platform=linux)
...
prebuild-install http request GET https://github.com/MayhemYDG/iltorb/releases/download/v2.0.1/iltorb-v2.0.1-node-v59-linux-x64.tar.gz
prebuild-install http 404 https://github.com/MayhemYDG/iltorb/releases/download/v2.0.1/iltorb-v2.0.1-node-v59-linux-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=9.2.0 runtime=node arch=x64 platform=linux)
...
node-pre-gyp ERR! Tried to download(403): https://node-zopfli.s3.amazonaws.com/Release/zopfli-v2.0.2-node-v59-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v59 ABI) (falling back to source compile with node-gyp)
Just blew away the entire polyfill-service directory and started from scratch. npm i and everything compiles automatically.
Not sure what I did wrong the first time; it's possible that I ran npm i under windows, which of course didn't compile things, and then switched to linux to run the service. Woulda been dumb, but understandable since file system perf on native windows is about 2x faster than in WSL.
So I'd say this can be closed.
Thanks for writing this all up @njbotkin, hopefully if someone else has the same issue they can find this issue and see how you solved it :-)
Just had a same kind of problem:
error An unexpected error occurred: "/home/jdeniau/code/makeup/node_modules/oniguruma: Command failed.
Exit code: 1
Command: sh
Arguments: -c node-gyp rebuild
Directory: /home/jdeniau/code/makeup/node_modules/oniguruma
Output:
module.js:549
throw err;
^
Error: Cannot find module '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
The problem for me was node-gyp. I followed the instruction here and it seems to be OK
Most helpful comment
Got it to work. I needed to run
npm iinnode_modules/iltorbnode_modules/node-zopfliWhich compiled their bindings.