Pass command line arguments to node-gyp
See original GitHub issueI have an electron application which depends on a native module that I am writing.
When I run electron-forge package
, it fails at Preparing native dependencies: 0/1
:
gyp: Undefined variable BASE_DIR in binding.gyp while trying to load binding.gyp
I usually pass the BASE_DIR
as a command line argument to node-gyp (this also works for npm install):
node-gyp rebuild --BASE_DIR=`pwd`
npm install ../addon --BASE_DIR=`pwd`
Is there a way to pass this command line argument with electron-forge? I have tried
electron-forge package --BASE_DIR=`pwd`
but this does not work:
$ electron-forge package --BASE_DIR=`pwd`
√ Checking your system
error: unknown option `--BASE_DIR'
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Pass command line arguments to node-gyp #150 - GitHub
I have an electron application which depends on a native module that I am writing. When I run electron-forge package, it fails at...
Read more >How do I pass command line arguments to a Node.js program?
The simplest way of retrieving arguments in Node.js is via the process.argv array. This is a global ...
Read more >How do I pass command line arguments to a Node.js program?
We can pass any number of command-line arguments while invoking a Node.js application by typing them in after the name of the file,...
Read more >How To Pass Command-Line Arguments in Node.js (2022)
argv property returns an array containing the command-line arguments passed when the Node.js process was launched. The first element will be process.execPath ....
Read more >How To Handle Command-line Arguments in Node.js Scripts
Node.js supports a list of passed arguments, known as an argument vector. The argument vector is an array available from process.argv in your ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I believe they do in the case of
node-gyp
but I consider that unsafe as it means random args can flow down the spawn tree and cause unexpected behavior.Closing this out as it should be tracked upstream in
electron-rebuild
if it isn’t already 👍