npm / npm/cli

CLI should error out if bin exec path doesn't exist

Open
#5,515 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage Release 8.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

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

I had this in package.json:

 "bin": {             
    "ores-git-commit-all": "./scripts/git-commit-all.sh.sh",
    "ores-mv-most-recent-pub-to-final": "./scripts/publish-most-recent-file.sh"
  },

I was running npm link and couldn't figure out why the ores-git-commit-all command was not being installed.
Turns out it was a typo

 "bin": {                                               v-------------- typo here
    "ores-git-commit-all": "./scripts/git-commit-all.sh.sh",
    "ores-mv-most-recent-pub-to-final": "./scripts/publish-most-recent-file.sh"
  },
Expected Behavior

I would expect the CLI to at least log a warning

Steps To Reproduce
  1. Node 18, npm 8
  2. package.json configured liked above
  3. npm link from repo root
  4. no error appears
Environment

macos with following npm version output:

{
  npm: '8.19.1',
  node: '18.9.0',
  v8: '10.2.154.15-node.12',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '108',
  nghttp2: '1.47.0',
  napi: '8',
  llhttp: '6.0.9',
  openssl: '3.0.5+quic',
  cldr: '41.0',
  icu: '71.1',
  tz: '2022b',
  unicode: '14.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing npm link's handling of the package.json bin entries, using the reported missing ./scripts/git-commit-all.sh.sh path as the reproduction case. Run the Node 18/npm 8 reproduction and verify that a missing executable path produces a visible error or warning instead of being silently skipped.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.