GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — CLI --eval rejects valid trailing line comments when input contains crypto · Issue #67159 · nodejs/node

CLI --eval rejects valid trailing line comments when input contains crypto #67159

New issue
Copy link
New issue
Copy link
Closed
#67162
Closed
CLI --eval rejects valid trailing line comments when input contains crypto#67159
#67162
Copy link
Labels
cliIssues and PRs related to the Node.js command-line interface.

Description

@CaliLuke
CaliLuke
opened on Oct 31, 2026
Issue body actions

Node.js version and platform

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

  1. Renegade334 commented on Nov 5, 2026

    @Renegade334
    Renegade334
    on Nov 5, 2026
    Member
    More actions

    Could we just get rid of this behaviour as a semver-major change? (Is there really widespread use of node:crypto in shell oneliners?)

  2. Renegade334
    added
    cliIssues and PRs related to the Node.js command-line interface.
    on Nov 5, 2026
  3. panva commented on Nov 18, 2026

    @panva
    panva
    on Nov 18, 2026
    Member
    More actions

    Could we just get rid of this behaviour as a semver-major change?

    Technically we could. Should we? No.

    Is there really widespread use of node:crypto in shell oneliners?

    Yes. Getting rid of this would also further diverge REPL from --eval and --print.

  4. Renegade334 commented on Nov 18, 2026

    @Renegade334
    Renegade334
    on Nov 18, 2026
    Member
    More actions

    Yes. Getting rid of this would also further diverge REPL from --eval and --print.

    It would align them. crypto in a REPL context points to the web global, whereas it points to the node module namespace object in --eval due to the custom override in eval_string.js.

  5. panva commented on Nov 18, 2026

    @panva
    panva
    on Nov 18, 2026
    Member
    More actions

    It would align them. crypto in a REPL context points to the web global, whereas it points to the node module namespace object in --eval due to the custom override in eval_string.js.

    That is correct. I thought you're suggesting removing all non-namespaced builtins from eval and print globals.

    Anyway, refs: #42083, #41779 (comment), there are dependents on this being preserved for eval and/or print.

  6. nodejs-github-bot
    closed this as completedin #67162on Nov 18, 2026
  7. LiviaMedeiros
    added a commit that references this issue on Nov 18, 2026

    lib: end --eval crypto wrapper code with a newline

    5a82340
  8. aduh95
    added a commit that references this issue on Nov 19, 2026

    lib: end --eval crypto wrapper code with a newline

    4fd45e2
  9. gabylb
    added a commit that references this issue on Nov 27, 2026

    lib: end --eval crypto wrapper code with a newline

    af380c1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliIssues and PRs related to the Node.js command-line interface.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.