Menu

npm ci can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync

Problem

ERROR Failed to compile: Error: Command failed with exit code 1: npm ci --unsafe-perm --prefer-offline --no-audit --legacy-peer-deps --registry=https://registry.npmjs.org/ 
npm ERR! code EUSAGE 
npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm ERR! Invalid: lock file's dotenv@8.6.0 does not satisfy dotenv@16.0.3 
npm ERR! Missing: dotenv@8.6.0 from lock file

npm ci can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync
Failed to compile


Resolution

There could be two situation where we could face this issue.

1. If we are seeing this in local build then we need to delete the package.json and package-lock.json and run the npm install to build the code again.

2. If we are seeing this issue on cloud deployment then we need to match the package.json and package-lock.json file with the local machine file where build was successful. If both file are not identical with cloud file then update the files on cloud with local files. 

No comments:

Post a Comment