Force specific package manager(s) to be used on a project
npm install only-allow-many> 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:
``json`
{
"scripts": {
"preinstall": "npx only-allow npm"
}
}
If you want to force cnpm, add:
`json`
{
"scripts": {
"preinstall": "npx only-allow cnpm"
}
}
If you want to force pnpm, add:
`json`
{
"scripts": {
"preinstall": "npx only-allow pnpm"
}
}
If you want to force yarn, add:
`json`
{
"scripts": {
"preinstall": "npx only-allow yarn"
}
}
If you want to force bun, add:
`json`
{
"scripts": {
"preinstall": "npx only-allow bun"
}
}
If you want to allow multiple package managers, add:
`json``
{
"scripts": {
"preinstall": "npx only-allow npm bun"
}
}