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

This kind of issue frequently happens in our environment because our development made in Windows Platform but actual Release or Deployment happens in Linux Platform.

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.

Currently, we are solving the issue below mentioned two ways

  1. I deleting the pakcage-lock.json and do npm install will solve

rm package-lock.json && npm i

  1. Manually removing the local dependency tree from package-lock.json and commit file.

Expected: Like configurable property

I would like to add configuration property in .npmrc to avoid local dependency tree ignored in package-lock.json like “package-lock=false”.

(Moved to #support for suggestions.)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.