Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix prebuild failing when NODE_ENV is set to production #154

Merged
merged 1 commit into from
Apr 6, 2023

Conversation

arthuro555
Copy link
Contributor

@arthuro555 arthuro555 commented Apr 1, 2023

A build server was throwing this error:

npm WARN config production Use `--omit=dev` instead.
npm WARN config cache-min This option has been deprecated in favor of `--prefer-offline`.
npm WARN using --force Recommended protections disabled.
npm ERR! code 127
npm ERR! path /worker/app-94f05526-221a-4bb5-939e-940577314505/node_modules/node-datachannel
npm ERR! command failed
npm ERR! command sh -c prebuild-install || (npm install --ignore-scripts && npm run _prebuild)
npm ERR! added 1 package, removed 1 package, and audited 59 packages in 12s
npm ERR! 
npm ERR! 7 packages are looking for funding
npm ERR!   run `npm fund` for details
npm ERR! 
npm ERR! found 0 vulnerabilities
npm ERR! 
npm ERR! > node-datachannel@0.4.0 _prebuild
npm ERR! > prebuild --backend cmake-js
npm ERR! prebuild-install WARN install No prebuilt binaries found (target=18.2.2 runtime=electron arch=x64 libc= platform=darwin)
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! sh: 1: prebuild: not found

Looking at package.json, I assume that the npm install is to install the build tools. Since afaik the server is using NODE_ENV to tell npm to run in production mode, and the command did not override the mode, it would install the dependencies in production mode, not installing the build tools.

I have not tested the fix but I assume this will do.

@murat-dogan
Copy link
Owner

For me also it looks OK but could you please test and report it here?

@arthuro555
Copy link
Contributor Author

Yep, I tested on the build server that showed issues, using my branch makes the build succeed 👍

@murat-dogan murat-dogan merged commit a04e0f0 into murat-dogan:master Apr 6, 2023
@arthuro555 arthuro555 deleted the patch-1 branch April 6, 2023 23:17
arthuro555 added a commit to arthuro555/geckos.io that referenced this pull request Apr 6, 2023
This allows to install the package when NODE_ENV is set to production and no prebuild is available, see murat-dogan/node-datachannel#154
yandeu pushed a commit to geckosio/geckos.io that referenced this pull request Apr 7, 2023
This allows to install the package when NODE_ENV is set to production and no prebuild is available, see murat-dogan/node-datachannel#154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants