Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] NPM Install includes transitive devDependencies for file: dependencies. #3371

Closed
1 task done
MicahZoltu opened this issue Jun 5, 2021 · 3 comments
Closed
1 task done
Labels
Release 7.x work is associated with a specific npm 7 release Wontfix this will not be worked on

Comments

@MicahZoltu
Copy link

MicahZoltu commented Jun 5, 2021

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

<root>/b/package-lock.json will look like:

{
	"name": "b",
	"lockfileVersion": 2,
	"requires": true,
	"packages": {
		"": {
			"dependencies": {
				"a": "file:../a"
			}
		},
		"../a": {
			"devDependencies": {
				"typescript": "3.7.2"
			}
		},
		"node_modules/a": {
			"resolved": "../a",
			"link": true
		}
	},
	"dependencies": {
		"a": {
			"version": "file:../a",
			"requires": {
				"typescript": "3.7.2"
			}
		}
	}
}

Expected Behavior

<root>/b/package-lock.json should look like this:

{
	"name": "b",
	"lockfileVersion": 2,
	"requires": true,
	"packages": {
		"": {
			"dependencies": {
				"a": "file:../a"
			}
		},
		"../a": {
		},
		"node_modules/a": {
			"resolved": "../a",
			"link": true
		}
	},
	"dependencies": {
		"a": {
			"version": "file:../a",
			"requires": {
			}
		}
	}
}

Steps To Reproduce

<root>/a/package.json

{
	"devDependencies": {
		"typescript": "3.7.2"
	}
}

<root>/b/package.json

{
	"dependencies": {
		"a": "file:../a"
	}
}
cd a
npm install
cd ../b
npm install

Environment

  • OS: Windows 10
  • Node: 14.4.0
  • npm: 7.16.0
@MicahZoltu MicahZoltu added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Jun 5, 2021
@MicahZoltu
Copy link
Author

Recreation of #492 but in NPM 7.x.

@lgrahl
Copy link

lgrahl commented Nov 11, 2021

I just encountered this, too. The use case we have is dependencies in git submodules.

@ruyadorno
Copy link
Contributor

hi @MicahZoltu thanks for taking the time to bring that up to our attention.

I don't believe that extra info in the package-lock.json file is going to cause errors, if you're finding that is causing a problem for users, please also attach that to the report.

I believe we track dev dependencies info in the lock file since we might need that during lifecycle scripts, for linked deps we do run the prepare scripts among others.

If you believe there's an error that is caused by the extra info in the lock file please feel free to open a new issue along with the reported error. Thanks again!

@ruyadorno ruyadorno added Wontfix this will not be worked on and removed Bug thing that needs fixing Needs Triage needs review for next steps labels Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release 7.x work is associated with a specific npm 7 release Wontfix this will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants