question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Prestart scripts no longer run

See original GitHub issue
  • I’d be willing to implement a fix

Describe the bug

In both npm and yarn legacy, when running a script named xxx, if a script named prexxx exists it would be run beforehand. Likewise, a script named postxxx would be run afterwards.

In yarn berry, this is no longer the case; prestart, poststart no longer work for custom script names.

To Reproduce

{
  "name": "test-package",
  "scripts": {
    "prestart": "echo prestart",
    "start": "echo start"
  }
}

Screenshots

npm and yarn 1 work correctly: image

yarn berry works incorrectly: image

Sherlock repro

await packageJsonAndInstall({
  "scripts": {
    "prestart": "echo prestart",
    "start": "echo start"
  }
});
await expect(await yarn(`start`)).toContain(`prestart`);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
configuratorcommented, Feb 26, 2020

This should also be specified in the migration guide, as it is an incredibly large difference from how things used to work, and will break many user scripts.

1reaction
arcaniscommented, Feb 27, 2020

Now documented as of #1002

Read more comments on GitHub >

github_iconTop Results From Across the Web

NVM for windows is failing when using npm prestart scripts
I have nvm-windows 1.1.9 latest installed. I have tried a machine recycle, re-installing nvm for windows, deleting the packages and modules and ...
Read more >
telemetry-collector pre-start script times out and fails during ...
The pre-start script for the telemetry-collector job fails during an Apply Changes or deployment of the telemetry tile with a timeout error ......
Read more >
scripts - npm Docs
Due to the lack of necessary context, uninstall lifecycle scripts are not implemented and will not function. User. When npm is run as...
Read more >
Lifecycle Scripts | Yarn - Package Manager
Each time Yarn has to fetch a dependency from a "raw" source (such as a Git repository), it will automatically run yarn install...
Read more >
npm start fails - Google Groups
3 info using no...@v6.10.0 4 verbose run-script [ 'prestart', 'start', 'poststart' ] ... 21 error Make sure you have the latest version of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found