tsmailok
Help with postinstall: sh: nuxt: not found
Hello, I need help with a concern I have regarding the
postinstall
script that runs nuxt prepare
.
I have a Layer that lives in a monorepo but has its own deploy cycle, and what happens is that when it's being published, upon running pnpm install
, after it finishes installing, it starts executing the postinstall
script, and this script fails because it can't find nuxt, and it can't execute nuxt prepare playground
Since this is a private project, I created a repository with an example very similar to my Layer, and published it as an npm package so that it can be reproduced from StackBlitz in a new Nuxt project.
But it turns out that the error doesn't occur in StackBlitz 😕, and I tried using the same version of node and pnpm as StackBlitz in my local environment, but even so, I still get the error locally
The workaround for the issue that I have found is to add ignore-scripts=true
to the .npmrc
file, so I prevent the postinstall from running, another option is to remove the postinstall script from the package.json, that way the error can also be avoided
But I'm unsure if removing nuxt prepare playground
from the installation cycle of my Layer will bring any errors when this Layer is consumed? Would it be safe to do away with this script(postinstall)?
One of the tests I've been able to confirm that the error is that it can't find nuxt, is that I remove my Layer as a dependency from the package.json, run pnpm i
, and then run pnpm i my-layer
and since nuxt is already installed it runs the postinstall perfectly.
The repository is this one https://github.com/mailok/nuxt-base, in case someone looking at it can quickly identify the problem2 replies