Skip to content

ERR_PACKAGE_PATH_NOT_EXPORTED when requiring snappy/package.json #283

@aryamohanan

Description

@aryamohanan

Description:

Requiring snappy/package.json directly fails with the following error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in snappy/package.json

Reproduction:

npm install snappy@7.3.2
const path = "snappy/package.json";

try {
  require(path);
} catch (err) {
  console.error("Error:", err.message);
}

Expected Behavior:
require("snappy/package.json") should load the package.json file successfully.

Actual Behavior:
Node.js throws ERR_PACKAGE_PATH_NOT_EXPORTED because ./package.json is not listed in snappy’s "exports" field.

Environment:

  • OS: macOS M1
  • Node.js: v22.17.0
  • Snappy: 7.3.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions