yarnpkg-v3

How to run a postinstall script after


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.


Solution

  • 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.
    1. In a .yarnrc.yml at the root of your project, add your command: afterInstall: <your-command>