-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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] install --only=development
doesn't install needed dependencies if listed in production dependencies
#1669
Comments
A bit of a script to reproduce:
This results in a
If you don't specify a version with the
and the behaviour isn't exhibited. |
We are seeing this issue too but in our case it involves transitive dependencies not being installed. In our case we have https://www.npmjs.com/package/serverless-plugin-typescript declared in our dev dependencies, and https://www.npmjs.com/package/log4js declared in our regular dependencies. Each of these has a transitive dependency (regular not dev dependency) on the package https://www.npmjs.com/package/universalify. package.json
Regular install
Dev only install
I would expect that the universalify transitive dependency of serverless-plugin-typescript to be installed but it is not. |
Thanks @tyler-laberge for the additional reproduction! It does look like the same issue; if you're comfortable with it, could you try the patch from #1676 and see if that fixes it? |
Thanks to you all for the great work documenting all this here ❤️ Unfortunately as mentioned in the linked PR these changes might be too risky for v6 at this point in time. @isaacs I'll keep this issue around in order to serve as a placeholder to remember to add these test cases to arborist/v7 - feel free to close it after that 😊 |
@msbit FWIW I just tried the patch and that does seem to fix the issue |
Thanks @ruyadorno, getting this sorted out for v7 is still a good win. |
thanks @tyler-laberge for the handy reproduction case. I tested it with the latest beta version Thanks @msbit for bringing this one up to our attention! |
@ruyadorno How about making a change like this?
and in package-lock.json you'd have That way, one could have arbitrary groups of dependencies, and you could easily resolve which ones to install during a given run, via e.g. A good use-case for this is to have a linting group that's only installed during certain CI-runs. But would also be backwards-compatible (functionality-wise, that is) with dev-dependencies. |
Using a "dependencies" name would utterly break every npm ecosystem tool that expects it to be a deps object. |
@ljharb Yes, good point! This was mostly intended as a rough draft to illustrate the idea. I agree with you that you wouldn't want to make this breaking. What e.g. Ruby's Bundler did when they introduced dependency groups, was that the non-specified dependencies always belong to A similar strategy could be used here, e.g. the Just from the top of my head, you could have a syntax where
|
Current Behavior:
If I have a list of
dependencies
anddevDependencies
such thatdevDependencies[x]
depends ondependencies[y]
and I runnpm install --only=development
, onlydevDependencies[x]
is installed.In a related twist, swapping the direction of dependencies (such that
dependencies[x]
depends ondevDependencies[y]
) and runningnpm install --only=development
results in no packages being installed at all.Expected Behavior:
When running
npm install --only=development
I would expect all required directdevDependencies
and any transitive dependencies of any stripe (dependencies
,devDependencies
or unlisted) to be installed.Steps To Reproduce:
A concrete example involves
lodash
andjson-replace
(the former with no dependencies, and the latter with only one dependency, onlodash
):Swapping it around:
Environment:
The text was updated successfully, but these errors were encountered: