Preventing engine problems in next.js when working on teams

Node.js version setting :

When working on a team you can have multiple versions of node.js installed, so to prevent these problems we can add a .nvmrc file at the root of the project and write the node version your project to use :

18.0.0

Package manager setting :

We also need to configure the package manager we wanna use in our project, that is npm in this case, so create a npmrc file and write :

engine-strict=true

In your package.json file add the following :

"engines": {
    "node": ">=18.0.0",
    "npm": "please-use-npm"
  },

This code will prevent using a node version that is less than node 18 and prevents using something other than npm for packages. for example yarn/pnpm.