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] Neither --ignore-scripts nor --ignore-prepublish are respected by npm publish #2755

Closed
jeffrson opened this issue Feb 22, 2021 · 9 comments
Assignees
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release

Comments

@jeffrson
Copy link

jeffrson commented Feb 22, 2021

Current Behavior:

When a package.json contains a "prepublishOnly" script, this is executed regardless of calling npm via
npm --ignore-scripts or npm --ignore-prepublish

Expected Behavior:

I'm not sure, if "--ignore-prepublish" refers to "prepublish" only (:-)) or to "prepublishOnly" as well...

Anyway, IMO --ignore-scripts should prevent "prepublishOnly" from being run.

Steps To Reproduce:

Well, have package.json with

scripts: {
...
"prepublishOnly": "echo prepublishOnly",
...
}

and run npm publish --ignore-scripts --dry-run

Environment:

  • npm: 7.5.5

Maybe related to #2434?

npm6 did it right, btw.

Edit: also git tag is commit'ed - which might not be a good idea for "--ignore-scripts".

@jeffrson jeffrson added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Feb 22, 2021
@everhardt
Copy link

I think the bug is broader than just prepublishOnly: if I run npm publish --ignore-scripts it also runs the postpublish script. I have npm 7.5.3.

@Fdawgs
Copy link
Contributor

Fdawgs commented Apr 28, 2021

Also encountering this same issue using npm v7.10 with node.js v16.0.0

@darkobits
Copy link

#2434 reported this behavior for npm ci.

Per this issue, it's also happening with publish. Additionally, I'm also seeing it with link (version 7.12.1).

@jthomas
Copy link

jthomas commented May 11, 2021

I'm also seeing it with this command:

npm install --production --no-optional --ignore-scripts on npm v7.10 with node.js v16.0.0

@wraithgar
Copy link
Member

--ignore-prepublish is not a valid flag in npm@7

--ignore-scripts bug is fixed in this PR #3495

@darkobits
Copy link

darkobits commented Jul 1, 2021

Perhaps slightly off-topic for this issue, but are there plans to make this flag work for all commands for which it was supported in NPM 6?

@wraithgar
Copy link
Member

wraithgar commented Jul 1, 2021

If folks are seeing this with OTHER commands, open another issue.

Please be sure that it is not this other bug we are already tracking where git dependencies' prepare scripts are always being ran. #3300

@wraithgar
Copy link
Member

fixed in v7.20.0

@Fdawgs
Copy link
Contributor

Fdawgs commented Jul 16, 2021

Thanks @wraithgar!

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

No branches or pull requests

7 participants