Skip to content

package main points to missing dist/contentful.js #3285

Description

The published npm package currently advertises a package root entry point that is not shipped in the tarball.

Reproduction

rm -rf /tmp/contentful-cli-main-repro
mkdir -p /tmp/contentful-cli-main-repro
cd /tmp/contentful-cli-main-repro
npm init -y >/dev/null
npm install contentful-cli@4.0.2 --ignore-scripts --no-audit --no-fund

node -e "const p=require('./node_modules/contentful-cli/package.json'); console.log(p.main); console.log(require('fs').existsSync('./node_modules/contentful-cli/' + p.main))"
node -e "require('contentful-cli')"

Actual behavior

The first Node command prints:

dist/contentful.js
false

The package root import then fails with:

MODULE_NOT_FOUND
Cannot find module '/private/tmp/contentful-cli-main-repro/node_modules/contentful-cli/dist/contentful.js'. Please verify that the package.json has a valid "main" entry

Expected behavior

The package root should either resolve to a file included in the published package, or the invalid root main entry should be removed/updated if programmatic imports are unsupported.

Notes

npm view contentful-cli@4.0.2 main bin repository --json reports main: "dist/contentful.js" and bin.contentful: "bin/contentful.js".

npm pack --dry-run --json contentful-cli@4.0.2 shows bin/contentful.js and dist/lib/cli.js, but no dist/contentful.js. The CLI executable still installs and runs through bin/contentful.js, so this looks like package metadata/build-output alignment rather than a CLI runtime failure.

I also checked the current default branch: package.json still has "main": "dist/contentful.js", while bin/contentful.js and lib/cli.ts exist.

Environment checked: macOS arm64, Node.js v24.3.0 and v24.14.0, npm 11.4.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions