In order to prevent build errors during an npm install, your package.json should not include opencv4nodejs, and instead should include/require the global package either by requiring it by absolute ...
npm ERR! Failed at the opencv-build@0.0.17 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR ...