pnpm / pnpm

Fast, disk space efficient package manager
https://pnpm.io
MIT License
28.99k stars 971 forks source link

pnpm deploy runs npm scripts prepare #7282

Open jezsung opened 9 months ago

jezsung commented 9 months ago

Verify latest release

pnpm version

8.10.0

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

CLI

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

No response

Reproduction steps

Add a prepare npm script and run the pnpm deploy command. The prepare npm script runs as if you run the pnpm install command.

Describe the Bug

pnpm deploy command runs npm scripts such as prepare. It causes issues when running the deploy command with the --prod flag. The command fails due to missing dependencies that the npm script requires.

I'm not sure if npm scripts are supposed to be run when running the deploy command.

A workaround for this issue is to use the --ignore-script flag.

pnpm deploy --filter=app --ignore-script --prod ./prod

I confirmed the --ignore-script flag works but it's not documented currently.

Expected Behavior

I think either npm scripts shouldn't be run or this behavior needs to be documented.

Which Node.js version are you using?

20.9.0

Which operating systems have you used?

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

No response

ennioVisco commented 9 months ago

Verify latest release

  • [x] I verified that the issue exists in the latest pnpm release

pnpm version

8.10.0

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

CLI

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

No response

Reproduction steps

Add a prepare npm script and run the pnpm deploy command. The prepare npm script runs as if you run the pnpm install command.

Describe the Bug

pnpm deploy command runs npm scripts such as prepare. It causes issues when running the deploy command with the --prod flag. The command fails due to missing dependencies that the npm script requires.

I'm not sure if npm scripts are supposed to be run when running the deploy command.

A workaround for this issue is to use the --ignore-script flag.

pnpm deploy --filter=app --ignore-script --prod ./prod

I confirmed the --ignore-script flag works but it's not documented currently.

Expected Behavior

I think either npm scripts shouldn't be run or this behavior needs to be documented.

Which Node.js version are you using?

20.9.0

Which operating systems have you used?

  • [x] macOS
  • [ ] Windows
  • [ ] Linux

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

No response

That command is super buggy unfortunately...

TeChn4K commented 6 months ago

And even worse, it runs prepare scripts of all workspaces, despite the --filter arg

josefaidt commented 6 months ago

I've run into the exact same thing and had a similar "a-ha" moment when I realized --ignore-scripts works. imo this is a fantastic command, but needs a bit of love and documentation. I've run into similar, confusing issues https://github.com/pnpm/pnpm/issues/7286