Skip to content

Instantly share code, notes, and snippets.

@rifayetuxbd
Last active October 18, 2023 02:35
Show Gist options
  • Save rifayetuxbd/4a0ba5b5ec86c62ebc8c6bd9d24facdf to your computer and use it in GitHub Desktop.
Save rifayetuxbd/4a0ba5b5ec86c62ebc8c6bd9d24facdf to your computer and use it in GitHub Desktop.

Allow only pnpm

  1. Create .npmrc and include below content at the root of the project
engine-strict = true
  1. Add engines in package.json
{
  "scripts" {
    "preinstall": "npx -y only-allow pnpm",
  },
  "engines": {
    "npm": "Please use pnpm instead of NPM to install dependencies",
    "pnpm": ">= LATEST_PNPM_VERSION_USED", // ">= 8.9.2"
    "node": "ALLOWED_NODE_VERSIONS" // "^18.13.0 || >=20.0.0"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment