Skip to content

[BUG] npm v8.11.0 not seeing locally installed package when running versioned command #5018

@shayneczyzewski

Description

@shayneczyzewski

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

With a clean npm/npx environment and the corresponding package installed locally in node_modules, when running a versioned npm exec/npx command, like: npm exec prisma@3.9.1, v8.5.5 finds it in the project and does not ask to install, but v8.11.0 asks you to install it, like so:

Screen Shot 2022-06-14 at 10 42 52 AM

Expected Behavior

I would expect it to behave like v8.5.5, find the locally installed version, and not request you install it, like so:

Screen Shot 2022-06-14 at 10 43 59 AM

Steps To Reproduce

  1. In several different environments tested so far...
  2. Clone this sample repo: https://github.com/shayneczyzewski/npm-prisma-repro
  3. Clear your npm (npm cache clean --force) and npm (rm -rf ~/.npm/_npx) caches
  4. Run npm install in the project
  5. nvm use 16.15.0 and observe output of npm exec prisma@3.9.1 is the help command [Expected]
  6. nvm use 16.15.1 and observe output of npm exec prisma@3.9.1 is a request to install

Environment

  • npm: v8.11.0
  • Node.js: v16.15.1
  • OS Name: macOS Monterey (Version 12.4)
  • System Model Name: MacBook Air M1 2020
  • npm config:
; node bin location = /Users/shayne/.nvm/versions/node/v16.15.1/bin/node
; node version = v16.15.1
; npm local prefix = /Users/shayne/dev/issueRepro/node-16.15.1-failure
; npm version = 8.11.0
; cwd = /Users/shayne/dev/issueRepro/node-16.15.1-failure
; HOME = /Users/shayne
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 8.xwork is associated with a specific npm 8 releasecmd:execrelated to `npx`ws:libnpmexecRelated to the libnpmexec workspace

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions