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 dedupe is not running during npm install #1179

Closed
trusktr opened this issue Apr 20, 2020 · 4 comments
Closed

[BUG] npm dedupe is not running during npm install #1179

trusktr opened this issue Apr 20, 2020 · 4 comments

Comments

@trusktr
Copy link

trusktr commented Apr 20, 2020

❯ npm -v
6.14.4

What

I ran npm install in a project, then my npm ls output showed:

❯ npm ls solid-js
@lume/create@ /home/trusktr/src/lume+create
├─┬ @lume/[email protected]
│ ├─┬ @lume/[email protected]
│ │ └── [email protected] 
│ └── [email protected] 
└── [email protected] 

Notice it does not say deduped anywhere.

Then I had to manually run npm dedupe for things to be deduped:

❯ npm dedupe
removed 2 packages and audited 1254 packages in 0.798s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

                                                                                                                                       
❯ npm ls solid-js
@lume/create@ /home/trusktr/src/lume+create
├─┬ @lume/[email protected]
│ ├─┬ @lume/[email protected]
│ │ └── [email protected]  deduped
│ └── [email protected]  deduped
└── [email protected] 

And now deduped appeared in the npm ls output.

Steps to Reproduce

I am unable to reproduce at the moment, but what I described above is exactly what I observed.

If I encounter it again, I will come back.

Expected Behavior

npm install should dedupe things.

@ljharb
Copy link
Contributor

ljharb commented Apr 20, 2020

Deduping isn't always a safe operation; npm install shouldn't dedupe by default. If you want that, run npm ci.

@trusktr
Copy link
Author

trusktr commented Apr 20, 2020

@ljharb The reason I can't reproduce this at the moment is because npm install (and npm install @lume/package if I start without that package listed in package.json) are actually deduping by default. It seems like it does dedupe by default, just as I always have expected. But I'm not sure why in the above case it didn't (just this one time).

If I start without @lume/element in my package.json, the following output shows that npm does dedupe by default like I normally expect (except the one time I reported above):

❯ npm i
added 136 packages from 120 contributors and audited 1222 packages in 1.482s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


❯ npm ls solid-js
@lume/create@ /home/trusktr/src/npm+cli
└── (empty)


❯ npm i @lume/element
+ @lume/[email protected]
added 17 packages from 30 contributors and audited 1253 packages in 2.878s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


❯ npm ls solid-js
@lume/create@ /home/trusktr/src/npm+cli
└─┬ @lume/[email protected]
  ├─┬ @lume/[email protected]
  │ └── [email protected]  deduped
  └── [email protected]

Note the deduped.

That's always the case. Otherwise I'd have ran into many issues by now with libs exporting singletons (React, Solid, etc).

@trusktr
Copy link
Author

trusktr commented Apr 20, 2020

If npm install behaves significantly different than npm ci in deduping vs not deduping, that'll cause headaches.

@trusktr
Copy link
Author

trusktr commented Apr 20, 2020

Anywho, npm is back to normal, deduping things a I normally expect, so I'll just close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants