Force a specific package manager to be used on a project
Add a preinstall script to your project's package.json.
If you want to force npm, add:
{
"scripts": {
"preinstall": "npx only-allow@1.2.2 npm"
}
}If you want to force cnpm, add:
{
"scripts": {
"preinstall": "npx only-allow@1.2.2 cnpm"
}
}If you want to force pnpm, add:
{
"scripts": {
"preinstall": "npx only-allow@1.2.2 pnpm"
}
}If you want to force yarn, add:
{
"scripts": {
"preinstall": "npx only-allow@1.2.2 yarn"
}
}If you want to force bun, add:
{
"scripts": {
"preinstall": "npx only-allow@1.2.2 bun"
}
}