Skip to content

[BUG] Shebang is not valid for project dir and npm pack #7779

@andrew-aladjev

Description

@andrew-aladjev

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

mkdir '/tmp/#'
cd '/tmp/#'
npm pack

Could not read package.json: Error: ENOENT: no such file or directory, open '/tmp/package.json'

It doesn't matter how long dir name will be, if it contains shebang than npm pack tries to read package.json from parent dir.

Expected Behavior

All printable ascii symbols expect / should be valid for project dir.

Steps To Reproduce

No response

Environment

  • npm: 10.8.1
  • Node.js: v20.16.0
  • OS Name: Ubuntu 24.04.1 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions