`pnpm dev` échoue à cause de `sharp` : l'avertissement qui bloque tout
Je lance pnpm dev et rien ne démarre. Pas d'erreur dans mon code. Juste ça : [ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: sharp@0.34.5 Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts. [ERROR] Command failed with exit code 1: pnpm install Avant de lancer le script, pnpm vérifie l'état des dépendances. Cette vérification échouait, donc le serveur ne partait…
When attempting to launch `pnpm dev`, users encountered an issue where the process failed to start. The error message displayed was "[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: sharp@0.34.5". Running "pnpm approve-builds" was suggested as a solution to determine which dependencies should be permitted to execute scripts. Before initiating the script, `pnpm` would inspect the status of dependencies; however, this check failed, causing the server never to launch.
Recent versions of `pnpm` no longer run installation scripts for dependencies without explicit approval. The setting `allowBuilds`, introduced in 10.26, allows users to approve these scripts. Any unlisted package is treated as unverified and defaults to producing an error. `sharp`, an image optimization tool utilized by Next.js, had a script responsible for installing its native binary.
The user's `pnpm-workspace.yaml` file contained an unfulfilled location: `allowBuilds : sharp : set this to true or false`. The remedy involved setting `allowBuilds : sharp : true`, which allowed the `sharp` script to run, subsequently enabling `pnpm dev` to begin again. Alternatively, `pnpm approve-builds` could be used, which writes either "true" for an approved package or "false" for a denied one.
Users were advised against using `dangerouslyAllowAllBuilds`, as it permits all scripts, including those of future transitive dependencies. Running an installation script with elevated privileges meant that it was preferable to approve each script individually. Amine Affif, a full-stack developer based in Paris, shared his experience on amineaffif.com.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to