If you're looking for a different approach, consider utilizing the npm ci
command:
Essentially, the key contrasts between npm install and npm ci are as follows:
- The project must contain an existing package-lock.json or npm-shrinkwrap.json file.
- If the dependencies listed in the package lock don't align with those in the package.json file, npm ci will halt with an error instead of modifying the package lock.
- npm ci is capable of installing complete projects exclusively; individual dependencies cannot be installed using this command.
- If a node_modules folder already exists, it will be automatically deleted before npm ci initiates its installation process.
- No modifications will be made to package.json or any of the package-lock files; all installations remain unchanged.
Explore more about npm ci here!