npmnpm-install

Unable to perform npm install after cloning a repo from github


I'm cloning a project that I'm working on from another computer on to my home computer and I'm unable to do npm install. I've cloned the repo successfully but when I try and write npm install to install all the packages I get this:

npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was 
generated for lockfileVersion@2. I'll try to do my best with it!
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\simer\AppData\Roaming\npm-cache\_logs\2022-07-12T17_37_59_820Z-debug.log

Does anyone know why this is happening?


Solution

  • The version of installed npm on your machine differs substantially with the version used by the repository. Firstly try to remove(delete) package-lock.json file and run npm install again. This file is used to lock the configuration down to child and nested dependencies to exact versions!. That is often times not needed rather a problem for future version where dependent versions can't work with latest versions.

    Your 2nd try would be to install same npm version which was used to generate the project.

    BTW open up the package-lock.json can tell you exact story of what is required in exactness to run this project. try to install each component one by one and see which one is creating an issue.