Skip to content

[BUG] npx commands failing due to parsing bug #2410

@Chriscbr

Description

@Chriscbr

Current Behavior:

$ npx node -e "console.log(3)"
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `node -e console.log(3)'
npm ERR! code 2
npm ERR! path /Users/rybickic/Developer/empty-dir
npm ERR! command failed
npm ERR! command sh -c node -e console.log(3)

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/rybickic/.npm/_logs/2020-12-24T08_25_37_431Z-debug.log

Expected Behavior:

$ npx node -e "console.log(3)"
3

Steps To Reproduce:

See commands above.

I've tried running this with several npm version combinations, and it appears to be a regression introduced in npm 7.1.0. That is, with the [email protected] the command succeeds (prints 3), but starting in [email protected] it fails. This was brought to my attention when I was updating to the latest node release (v15.5.0) two days ago via nvm, which updates npm to 7.3.0 (changelog).

Environment:

  • OS: macOS Catalina 10.15.7
  • Node: 15.5.0
  • npm: 7.3.0

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions