Different package management tools download the same dependency, the version may be different
lead to bugs in the project
So to unify the package management tool
Create scritps/preinstall.js in the root directory
if(!/npm/.test(process.env.npm_execpath||'')){
console.warn(
`\u001b[33mThis repository must using npn as the package manager`+
`for scripts to work properly.\u001b[39m\n`,
)
process.exit(1)
}
Configuration commands in package.json
"preinstall":"node ./scripts/preinstall.js"
When using yarn or pnpm to install the package, an error will be reported, because the install will trigger preinstall (the lifecycle hook provided by npm)