How to run postinstall since I have to patch a npm package

I have a "postinstall": "patch-package" in my scripts within my package.json.
since I must patch a npm package.

It of course works locally but when I deploy to fly.io using github actions then I’m not quite sure where deploy.yml I should be calling the postinstall

I did try adding the patch npm packages task to deploy.yml as shown below but that doesn’t seem to work …

patch-npm-packages:
    name: 📦 Patch npm packages
    runs-on: ubuntu-latest
    steps:
      - name: ⬇️ Checkout repo
        uses: actions/checkout@v3

      - name: ⎔ Setup node
        uses: actions/setup-node@v3
        with:
          cache: npm
          cache-dependency-path: ./package.json
          node-version: 18

      - name: 📥 Install deps
        run: npm install

      - name: 📦 Patch npm packages
        run: npm run postinstall

That looks like a github workflow… that won’t normally affect what is deployed. Typically you would want to look at a Dockerfile to control what is deployed at fly.io.

Also, postinstall is automatically run by npm install. See: scripts | npm Docs

I wasn’t copying over the packages folder and I think that must be added to the dockerfile like you said.

Also, postinstall is automatically run by npm install.

That’s what I thought…

It was an issue with my Dockerfile. It was missing

COPY ./patches ./patches

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.