Back to Pnpm Io

Only allow pnpm

versioned_docs_archived/version-4.x/only-allow-pnpm.md

latest395 B
Original Source

When you use pnpm on a project, you don't want others to accidentally run npm install or yarn. To prevent devs from using other package managers, add the following preinstall script to your package.json:

json
{
  "scripts": {
    "preinstall": "npx only-allow pnpm"
  }
}

Next time, when someone runs npm install or yarn install, they'll get an error message in the console.