Skip to content

verify-deps-before-run=prompt doesn't remember pnpm install --production #9019

@TomiBelan

Description

@TomiBelan

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

10.1.0

Which area(s) of pnpm are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://gist.github.com/TomiBelan/c29d21ce9ac55354641bffbd9daa7171

Reproduction steps

  1. Have nonzero dependencies and nonzero devDependencies in package.json
  2. Enable verify-deps-before-run=prompt in .npmrc
  3. pnpm install --production
  4. pnpm run some_script_name (e.g. pnpm run hello in the above gist)

Describe the Bug

pnpm asks: Your "node_modules" directory is out of sync with the "pnpm-lock.yaml" file. This can lead to issues during scripts execution. Would you like to run "pnpm install" to update your "node_modules"? (Y/n)

If you press y, pnpm will install devDependencies and run the script.
If you press n, pnpm will run the script as is.

Expected Behavior

pnpm should remember that the most recent install was done with --production. (Perhaps inside node_modules/.pnpm-workspace-state.json.)

If the most recent install was --production, pnpm run should compare if current node_modules directory content is in sync with package.json dependencies only. If they are in sync, it should not prompt, just run the script. If they are not in sync, it should offer: Would you like to run "pnpm install --production" to update your "node_modules"?, and do exactly that when you press y.

Same with pnpm exec of course.

(Side note: I acknowledge that scripts which need devDependencies may fail. But that's normal. E.g. in this gist, it is understandable that pnpm install --production ; pnpm run format will print prettier: not found. This bug report focuses on the behavior of pnpm run hello.)

Thank you for your work. <3

Which Node.js version are you using?

v23.6.1

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy