Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove an invalid local dependency from package-lock.json and package.json?

Tags:

npm

Let's say that someone installed an invalid local dependency. (file does not exists locally)

package-lock.json

  "mock-framework": {
     "version": "file:../../../mock-framework",

package.json:

 "dependencies": {
    "mock-framework": "file:../../../mock-framework"
 }

I need to reinstall the framework, but it's located differently on my machine and does not follow the structure that was provided in the package locks. Because running the npm install command is giving me the error:

Could not install from "../../../mock-framework" as it does not contain a package.json file.

Would it be possible to clean it up through the command line? I tried with npm uinstall and still no luck.

like image 414
Carlos Miguel Colanta Avatar asked Nov 01 '25 16:11

Carlos Miguel Colanta


1 Answers

I recently faced similar issue with local dependency integrity in package-lock.json

Ideally npm uninstall should remove the entry in package-lock.json but since it is not and you only have one local framework as changed dependency, you can try following -

Fix the dependency path and run rm package-lock.json && npm i

Hope I'm inline to your problem statement.

like image 68
KunalMZ Avatar answered Nov 04 '25 16:11

KunalMZ