When NODE_ENV=production, 'prebuild' is not recognized as an internal or external command,
bsrdjan opened this issue · comments
When NODE_ENV set to "production", the installation of node-rfc package fails, with 'prebuild' is not recognized
error. The error log on heroku is posted here: SAP/node-rfc#122 (comment) and the same happens on Windows, with error log below.
Any ideas about the cause or in which direction to investigate?
Without NODE_ENV all works fine.
C:\src\node-rfc-test>npm install node-rfc
> node-rfc@1.0.6 preinstall C:\src\node-rfc-test\node_modules\node-rfc
> npm install cmake-js prebuild-install prebuild node-addon-api
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm notice created a lockfile as package-lock.json. You should commit this file.
+ node-addon-api@2.0.0
+ cmake-js@6.1.0
+ prebuild-install@5.3.3
+ prebuild@10.0.0
added 1 package from 50 contributors and audited 1181 packages in 16.449s
found 0 vulnerabilities
> node-rfc@1.0.6 install C:\src\node-rfc-test\node_modules\node-rfc
> prebuild-install --tag-prefix -r napi || npm run prebuild
'prebuild-install' is not recognized as an internal or external command,
operable program or batch file.
> node-rfc@1.0.6 prebuild C:\src\node-rfc-test\node_modules\node-rfc
> prebuild --backend cmake-js -r napi --force --strip --verbose --tag-prefix
'prebuild' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-rfc@1.0.6 prebuild: `prebuild --backend cmake-js -r napi --force --strip --verbose --tag-prefix`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-rfc@1.0.6 prebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\d037732\AppData\Roaming\npm-cache\_logs\2020-04-13T16_43_19_751Z-debug.log
npm WARN rfc-test@1.0.0 No description
npm WARN rfc-test@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-rfc@1.0.6 install: `prebuild-install --tag-prefix -r napi || npm run prebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-rfc@1.0.6 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\d037732\AppData\Roaming\npm-cache\_logs\2020-04-13T16_43_19_968Z-debug.log
C:\src\node-rfc-test>prebuild
'prebuild' is not recognized as an internal or external command,
operable program or batch file.
That's a broken setup. Particularly, prebuild-install --tag-prefix -r napi || npm run prebuild
. The recommended approach is prebuild-install <options> || node-gyp rebuild
(where node-gyp rebuild
can be replaced with other build tools of course). The prebuild
package is not for end users, it's meant for maintainers to make prebuilt binaries.
Also, prebuild-install
is missing in dependencies: https://github.com/SAP/node-rfc/blob/7c7aa4798d8bdf5b42c279080299cce30faf738e/package.json#L79-L82
If for some reason you do want to fallback to prebuild
(but I strongly recommend against it) then be sure to add that to dependencies as well.
I'm closing this, because there is no bug or actionable item here. Good luck!