Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a postinstall script after

Tags:

yarnpkg-v3

I am migrating from yarn version 1.22 to yarn v3.2.3. I have a prepare script that was running automatically after install.

My prepare script generates some files (FIY Nuxt 3 generated files).

It does not run anymore on yarn 3, and how can I get the same effect? I don't find it on https://yarnpkg.com/advanced/lifecycle-scripts. Maybe I am misreading.

like image 698
Lyokolux Avatar asked Jul 22 '26 22:07

Lyokolux


1 Answers

I have finally found a solution:

  1. Install the Yarn plugin after install: yarn plugin import https://raw.githubusercontent.com/mhassan1/yarn-plugin-after-install/v0.3.1/bundles/@yarnpkg/plugin-after-install.js.
  • See the command in the README to get the latest version.
  1. In a .yarnrc.yml at the root of your project, add your command: afterInstall: <your-command>
like image 124
Lyokolux Avatar answered Jul 24 '26 11:07

Lyokolux



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!