How to remove an invalid local dependency from package-lock.json and package.json?
How to remove an invalid local dependency from package-lock.json and package.json?
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.
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.
npm uinstall
1 Answer
1
I recently faced similar issue with local dependency integrity in package-lock.json
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 -
npm uninstall
package-lock.json
Fix the dependency path and run rm package-lock.json && npm i
rm package-lock.json && npm i
Hope I'm inline to your problem statement.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.