Skip to content

[BUG] npm publish complains on bin field examples from npm docs #7302

Closed
@mrazauskas

Description

@mrazauskas

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

npm publish complains and auto correct the bin field examples from npm docs.

Expected Behavior

Seems like the examples are correct, there is no need to complain or alter the code.

Steps To Reproduce

First example:

  1. Create fresh repo with npm init -y
  2. Add dummy file cli.js
  3. Copy bin field entry from npm docs to package.json:
"bin": {
  "myapp": "./cli.js"
}

Second example:

  1. Create fresh repo with npm init -y
  2. Add dummy file cli.js
  3. Copy bin field entry from npm docs to package.json:
"bin": "./cli.js"

Finally run npm publish --dry-run. In both cases npm complains:

npm WARN publish npm auto-corrected some errors in your package.json when publishing.  Please run "npm pkg fix" to address these errors.
npm WARN publish errors corrected:
npm WARN publish "bin[myapp]" script name was cleaned

Environment

  • npm: 10.2.4
  • Node.js: 20.11.1
  • OS Name: macOS
  • System Model Name: Macbook Pro
  • npm config:
; "user" config from /Users/(replaced)/.npmrc

//registry.npmjs.org/:_authToken = (protected) 

; node bin location = /Users/(replaced)/.n/bin/node
; node version = v20.11.1
; npm local prefix = /Users/(replaced)/Projects/x-npm-bin
; npm version = 10.2.4
; cwd = /Users/(replaced)/Projects/x-npm-bin
; HOME = /Users/(replaced)
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions