0

When I run npm install, remove or add any package (or do anything that changes the local package.json) and commit to a PR branch, I get the following error in the github actions "run npm ci" build.

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! 
npm ERR! Missing: webpack@5.74.0 from lock file
npm ERR! Missing: @types/eslint-scope@3.7.4 from lock file

Things i've tried:

  1. Deleting node modules & package-lock.json & running npm i - DOESNT WORK
  2. Changing my github main.yml to npm ci --legacy-peer-deps - DOES FIX THIS BUG but causes other weird bugs about paths to other React components withing my project to not be found with a Type error: Cannot find module '../ etc" (they all work fine if the old package-lock is used)
  3. Pasting the old package-lock.json to overwrite my local copy and committing - WORKS? But I can never actually remove or add packages.

Running npm ci locally works perfectly fine.

In summary: If I create a new branch from main > npm install a new package & push the updated package.json and package-lock.json to the branch > it fails the github actions check on npm ci with the above npm ERR because the package-lock.json does not match.

I'm stumped, any help would be greatly appreciated.

0 Answers0