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. 

ExperimentalWarning: The ESM module loader is experimental

Node.js has two module systems: CommonJS modules and ECMAScript modules.
Authors can tell Node.js to use the ECMAScript modules loader via the .mjs file extension, the package.json "type" field, or the --input-type flag. Outside of those cases, Node.js will use the CommonJS module loader.

Fetch API is an experimental feature

How to fix Fetch API warning in ReactJS?

ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time (Use `node --trace-warnings ...` to show where the warning was created)

Resolution

Pending