Hi Saurabh Thanks for the super easy explanation of Package-lock.json.
Right now I am learning React and every time I have to add new dependency in my app I use npm install somePackageName and the get the error
npm ERR! Cannot read property 'match' of undefined
so every time I delete package-lock.json file and again run the same command and this time with success result. This is what brought me here
That's a weird error. Maybe you should try having --save-dev or --save flag on npm install. Not sure about what the default npm install behavior is but normall --save or --save-dev will add it to package.json dependency object and it will be installed locally.
Hi Saurabh Thanks for the super easy explanation of Package-lock.json.
Right now I am learning React and every time I have to add new dependency in my app I use
npm install somePackageName
and the get the errornpm ERR! Cannot read property 'match' of undefined
so every time I delete package-lock.json file and again run the same command and this time with success result. This is what brought me here
That's a weird error. Maybe you should try having
--save-dev
or--save
flag on npm install. Not sure about what the default npm install behavior is but normall--save
or--save-dev
will add it to package.json dependency object and it will be installed locally.tried that too but that didn't solved the problem...! I had to delete package-lock.json and then execute the command again...