Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unexpected behavior with publish dry-run #4398

Closed
2 tasks done
FStefanni opened this issue Feb 10, 2022 · 1 comment · Fixed by #7133
Closed
2 tasks done

[BUG] Unexpected behavior with publish dry-run #4398

FStefanni opened this issue Feb 10, 2022 · 1 comment · Fixed by #7133
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 8.x work is associated with a specific npm 8 release

Comments

@FStefanni
Copy link

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

Hi,

  1. npm publish --dry-run calls the package.json script "prepublishOnly"
  2. "prepublishOnly" executes a bash script: ./prepublish.sh
  3. ./prepublish.sh does the following:
#!/bin/bash
rm -fr node_modules
npm install .
npm run build
  1. The ./prepublish.sh fails, not finding tsc, and actually the node_modules directory is missing!

So it seems to me that somehow the npm commands run by the ./prepublish.sh script inherits the "--dry-run" option.
Is this the expected behavior?
IMHO it should be not, and older versions did work properly as far as I remember.
Or, at least, there should be an option to not inherit dry-run behavior.

Please note that if I run the ./prepublish.sh script, it works fine. This behavior happens only when running npm publish --dry-run.

Regards

Expected Behavior

npm commands should perform what explicitly told to do.
Or there should be a way to perform the install-and-build check performed by my script.

Steps To Reproduce

Already posted before

Environment

  • npm: 8.4.1
  • Node.js: 17.1.0
  • OS Name: Linux
  • System Model Name: Debian Testing
@FStefanni FStefanni added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Feb 10, 2022
@fritzy fritzy added the Priority 2 secondary priority issue label Feb 14, 2022
@fritzy
Copy link
Contributor

fritzy commented Feb 14, 2022

May be related to #2687.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants