You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI --eval rejects valid trailing line comments when input contains crypto #67159
Node.js v26.12.1, macOS arm64. Reproduced with the Node executable directly; no packages or application setup are needed.
Reproduction
Run:
node -e 'crypto; // comment'
The command exits with status 1. It reports this generated source and error:
(crypto=>{{crypto; // comment}})(require('node:crypto'))
SyntaxError: Unexpected end of input
The same failure occurs with --input-type=commonjs. These controls both exit successfully:
node -e 'crypto;'
node -e 'crypto; /* comment */'
Adding a newline after the line comment also succeeds.
Expected behavior
The original command should exit successfully. Its input is valid JavaScript; the trailing line comment should not consume code inserted by the CLI. This affects command generators or scripts that append a line comment to an otherwise valid --eval input containing crypto.
Source evidence
In eval_string.js at v26.12.1, the crypto compatibility branch inserts the input into a wrapper without a newline before the closing syntax. The error above shows that closing syntax on the commented line. This is a standalone CLI reproduction, not a production-incident claim.
Activity