News for hackers. Stuff that matters.
Re:JavaScript is Eating the World by jchw on Thursday August 24, 2017 @09:30AM (#15089907)
JS has the appeal that it's something a lot of people already have good amounts of experience with. And ES2015+ features add to the learning curve, but also give some much needed aid to existing problems; it's easy to pick up on async/await when you already know how promises work.

Meanwhile, trying to find Go developers can be a challenge. And the learning curve is low, but there's plenty of low-level gotchas like dealing with concurrency and memory usage. (Yes, even in a garbage collected language, this manages to be a problem.)

In Node, you run into less issues because if you have a problem to solve you just npm install something.

That being said, my enthusiasm ends there. Every experience I have with trying to tie a database into Node has been horrible. Also, I think event loop based programming is missing the mark even if it beats out previous methods; I think Go and other CSP based languages like Erlang have the real right answer. I think if we really start seeing huge core counts, it will become apparent that a single thread event loop eventually starts to become a bottleneck. Also, NPM has an insane number of packages, but the quality is extremely variable - much more than PyPI, though I'm not saying everything on PyPI is magically production ready.

I guess what I'm saying is, maybe I should start learning Rust.

Re:JavaScript is Eating the World by talmand on Thursday August 24, 2017 @09:40AM (#15090000)
I'm beginning to think npm has joke potential like regex.

"I had a problem. I started using regex and now I have two problems."

Becomes...

"I had a problem. I ran npm install and now I have 21,735 problems."

Re:JavaScript is Eating the World by falcolas on Thursday August 24, 2017 @09:52AM (#15090094)
It bothers me that I have to agree with this. I watched an NPM install once, and noticed that one particular library was downloaded and compiled somewhere around 40 times (and each compiled version was different).

Think about that for a moment: one library, 40 versions downloaded and compiled to fill NPM dependencies. What if there was a vulnerability in a version of that library - how do I audit that? Can I even fix it myself without hosting my own NPM registry? Bandwidth? Computation costs (a thing again, with cloud computing)? Disk space costs?

It makes me glad we just use Docker; so I don't have to try and make sense of the NPM madness from day-to-day. Just Docker's own brand of madness.

Re:JavaScript is Eating the World by alayek on Thursday August 24, 2017 @10:07AM (#15090206)
Personal experience: NPM can be mind-bogglingly slow in Windows. In my previous day-job, an NPM install on Windows 7 could take hours, for some reason. That's NPM 3 with about 20 dependencies on a small project.

NPM on Windows also had other problems such as Python path is wrong or C++ compiler is missing.

Then we switched to Yarn. Uncached install took about 2-3 minutes, and cached install would finish in seconds.

Recently, NPM 5 has been released, and it's been competing well against Yarn.

Re:JavaScript is Eating the World by jchw on Thursday August 24, 2017 @10:16AM (#15090265)
Still a bigger fan of Yarn here. My personal tests have Yarn running a bit faster still, but I also like that Yarn's command syntax is easier. NPM seems content with making a million aliases of everything and it's annoying. I think they even added 'add' from Yarn.

Also, Yarn's run command can be used to run locally installed NPM binaries, not just NPM scripts. i.e., you can do `yarn run -- webpack` and it will run the local copy of Webpack. This is handy imo, and as far as I know NPM doesn't do it.

Re:JavaScript is Eating the World by alayek on Thursday August 24, 2017 @10:25AM (#15090341)
I didn't know that, thanks for pointing out.

I like Yarn run, because if I'm running a lint or tests, it errors out with error messages related to the specific process.

If you run via npm run, it would throw lot of extra error messages, making excuses that it wasn't NPM's fault the command exited with a non-zero status etc.; and hiding the relevant error messages.

And as always, you can just run a script as yarn script, instead of yarn run script; like yarn lint:src, instead of yarn run lint:src.

NPM does it only for a few common ones.

Also, Yarn run picks up right node version from .nvmrc - you don't have to run an nvm use and switch to it.

Re:JavaScript is Eating the World by fahrradflucht on Thursday August 24, 2017 @10:49AM (#15090525)
FWIW npm 5 comes with npx [0] which basically does similar things. If you run npx webpack it would use the local copy of webpack or even install one run it and discard it.

[0] https://www.npmjs.com/package/npx

Re:JavaScript is Eating the World by eliaslfox on Thursday August 24, 2017 @12:01PM (#15091209)
That's not the same thing. Npx is for running commands you install from npm, and yarn [command] allows you to run scripts defined in your package.json file.
Re:JavaScript is Eating the World by fahrradflucht on Thursday August 24, 2017 @02:02PM (#15092476)
npm always did this. The OC said that he likes that yarn can also run local binaries that are not a npm script.
Re:JavaScript is Eating the World by flavio81 on Thursday August 24, 2017 @11:01AM (#15090633)
For me, going from Lisp package installs to Node package installs was like traveling from a Bahamas beach to Siberia, with the same clothes.

ES7 is okay, Node.js is good, V8 is GREAT, but NPM is an atrocity.

Re:JavaScript is Eating the World by TheDongIsYou on Friday August 25, 2017 @02:57AM (#15096691)
Can you elaborate why? Aside from install times which there are solutions for.
Re:JavaScript is Eating the World by stephengillie on Thursday August 24, 2017 @10:51AM (#15090540)
I've got 99 problems, but npm isn't 21,735 of them.