r/node • • Apr 09 '20

Typical npm install

Post image
301 Upvotes

45 comments sorted by

89

u/Pizza_Fox Apr 10 '20

why do you have 880 thousand packages installed

184

u/lenswipe Apr 10 '20

because he wanted to sort an array

5

u/[deleted] Apr 10 '20

npm i finished-business-logic

2

u/fastidious-magician Apr 11 '20
npm install sign-flip

6

u/lenswipe Apr 10 '20
added 92841619947272829193753 packages from 3 contributors and audited 17368 packages in 84 hours

2

u/[deleted] Apr 11 '20

Whoa look at this guy showing off his game rig

1

u/vendettacbs Apr 10 '20

😂 so relatable... This should go to some tech jokes subreddit

33

u/Tom_Ov_Bedlam Apr 10 '20

Package.json more dense than a black hole.

3

u/[deleted] Apr 10 '20

*node_modules directory. Ftfy

11

u/eeeBs Apr 10 '20

Why not!

7

u/reddit4matt Apr 10 '20

He doesn’t have 80% of all modules on npm installed. It is the confusing way npm reports. It counts all possible paths to all modules. If 10 of your modules use underscore JS it is counted 10 times even though you may only have one version actually installed.

2

u/mohammedgqudah Apr 10 '20

Thanks for pointing that out

26

u/Fantastic_Sell Apr 10 '20 edited Apr 10 '20

I accidentally forgot a character in a package name and I got some ancient package with hundreds of vulnerabilities according to npm lol

11

u/SocialAnxietyFighter Apr 10 '20

You are lucky you didn't get hacked, really.

24

u/redditindisguise Apr 10 '20

Dependencies and bundlers are somehow both the best and worst things to happen in the industry.

0

u/[deleted] Apr 10 '20

[deleted]

9

u/[deleted] Apr 10 '20

If those dependencies are maintained and secure, then I'd rather packages depend on them, instead of being incented to write their own implementation.

23

u/realbattousaix Apr 10 '20

Run Npm audit fix, and then, RIP application. lol

0

u/[deleted] Apr 10 '20

[deleted]

2

u/lenswipe Apr 10 '20

...and then you run npm run test to make sure your app still works...right?

3

u/martiandreamer Apr 10 '20

What packages are you installing, and what versions? We regularly ‘npm install’ and typically don’t have issues with vulnerable packages.

1

u/fastidious-magician Apr 11 '20

This is actually a 1 year old create-react-app client. ¯_(ツ)_/¯

14

u/ilovecheeses Apr 10 '20

What packages are you installing, and what versions?

Yes.

20

u/Cono52 Apr 10 '20

I heard you like vulnerabilities.... SO we put a vulnerability in your vulnerability.

54

u/[deleted] Apr 10 '20

npm audit fix —force —yeet

18

u/chrissilich Apr 10 '20

Tell me —yeet does something

8

u/adover Apr 10 '20

Time for a node modules spring clean perhaps?

7

u/cheers- Apr 10 '20

This post was sponsored by Prototype Pollutionâ„¢

4

u/frezik Apr 10 '20

And half of them are minimist.

4

u/Parasomnopolis Apr 10 '20

4

u/Vaakmeister Apr 10 '20

Might as well add another dependency, it’s the npm way \o/

2

u/Uiropa Apr 10 '20

Only 1 critical, not great, not terrible

0

u/IAmMadSwami Apr 10 '20

Move to yarn, issues solved :P But yeah, there are way too many packages

-24

u/juniorgray07 Apr 10 '20

Use yarn instead, that way solves that kind of problems

3

u/evert Apr 10 '20

What kind of problem would it solve for this case?

-3

u/[deleted] Apr 10 '20

I believe one of the things it does it upgrades packages versions of dependency packages, if it is allowed by the ^ indicator. So you only download one version of the package used by many dependent packages. It will certainly warn you of vulnerabilities..

-10

u/juniorgray07 Apr 10 '20

At least until now i do not have to use npm audit or npm fix anymore since i am using yarn

8

u/evert Apr 10 '20

So either Yarn doesn't warn you of security bugs or it automatically upgrades packages without your intervention?

3

u/Earhacker Apr 10 '20

He’s bullshitting. yarn audit is very much a thing.

2

u/SippieCup Apr 10 '20

Both seem less than ideal.

0

u/[deleted] Apr 10 '20

[deleted]

2

u/Earhacker Apr 10 '20

It’s an alternative to the NPM CLI tool, but it uses the same package repository. Yarn’s big USP was that it caches dependencies locally. So if you yarn add [email protected] in one repo, it’ll download, but when you install it in another repo you’ll get the locally cached version, saving you a download. That makes a huge difference when your project has a lot of dependencies, and also means you can be offline while you work, but I think newer versions of NPM have the same feature.

Yarn also includes support for workspaces, which are very useful for monorepos, but my place doesn’t use monorepos so I do t think I can speak to its efficacy.

-12

u/juniorgray07 Apr 10 '20

Honestly is just preferences things because i used to use npm, but later then i started using yarn but you can use npm instead, all the packages have a yarn installation also.