-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
Closed
Labels
cliIssues and PRs related to the Node.js command line interface.Issues and PRs related to the Node.js command line interface.confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.
Description
- Version: v11.9.0
- Platform: Darwin
- Subsystem:
If NODE_OPTIONS starts with a leading space the --require option does not function (possibly other flags but I've only tested --require).
Specifically:
NODE_OPTIONS="--require ./some-file.js" node ./other-file.js^ will properly require ./some-file.js prior to executing ./other-file.js
Whereas:
NODE_OPTIONS=" --require ./some-file.js" node ./other-file.js^^ will not require ./some-file.js at all
Steps to reproduce:
mkdir test-node-options
cd test-node-options
echo "console.log('first!')" > first.js
echo "console.log('second!')" > second.jsThen compare the output of these two commands:
# "broken"
NODE_OPTIONS=" --require ./first.js" node ./second.js
# "working"
NODE_OPTIONS="--require ./first.js" node ./second.js
I stumbled across this while attempting to use Yarn's PnP system on Node 11 (see yarnpkg/yarn#7092 for the original report there). Yarn 1.13.0 adds --require ${PATH_TO_PNP_FILE} to NODE_OPTIONS which causes this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
cliIssues and PRs related to the Node.js command line interface.Issues and PRs related to the Node.js command line interface.confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.