Using 'import' crashes the REPL
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
Version
26.1.0
Platform
Windows
Subsystem
repl
What steps will reproduce the bug?
C:\>node
Welcome to Node.js v26.1.0.
Type ".help" for more information.
> import
node:internal/readline/emitKeypressEvents:74
throw err;
^
SyntaxError: Unexpected token (1:6)
at pp$4.raise (node:internal/deps/acorn/acorn/dist/acorn:3766:15)
at pp$9.unexpected (node:internal/deps/acorn/acorn/dist/acorn:799:10)
at pp$9.expect (node:internal/deps/acorn/acorn/dist/acorn:793:28)
at pp$8.parseImportSpecifiers (node:internal/deps/acorn/acorn/dist/acorn:2020:10)
at pp$8.parseImport (node:internal/deps/acorn/acorn/dist/acorn:1966:30)
at pp$8.parseStatement (node:internal/deps/acorn/acorn/dist/acorn:1019:51)
at pp$8.parseTopLevel (node:internal/deps/acorn/acorn/dist/acorn:856:23)
at Parser.parse (node:internal/deps/acorn/acorn/dist/acorn:611:17)
at Parser.parse (node:internal/deps/acorn/acorn/dist/acorn:678:37)
at parse (node:internal/deps/acorn/acorn/dist/acorn:6254:19) {
pos: 6,
loc: Position { line: 1, column: 6 },
raisedAt: 6
}
Node.js v26.1.0
C:\>
How often does it reproduce? Is there a required condition?
everytime
What is the expected behavior? Why is that the expected behavior?
no crash
What do you see instead?
crash
Additional information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure in the Windows Node.js REPL with the standalone import input, then trace the REPL path through internal/readline/emitKeypressEvents and the Acorn parseImport stack shown in the report. Done means entering import no longer crashes the REPL, with regression coverage for this input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100