News for hackers. Stuff that matters.
Re:NPM proxy users receiving ERR 418 I'm a teapot by vorpalhex on Monday May 28, 2018 @10:28PM (#17176032)
Really disappointed in NPM lately. These past few months have been downright silly. How many major problems like this affect other package managers?
Re:NPM proxy users receiving ERR 418 I'm a teapot by PaulRobinson on Tuesday May 29, 2018 @03:50AM (#17177190)
Package management is hard. Ruby gems has had its issues and Go has got itself into a holy war just deciding how best to do dependency management.

However over 2018 we seem to have got to a point where I’m worrying about some basic professional competencies and communication systems inside the npm project. I don’t know much about it, but looking at it from a sideways glance, you have to start worrying about what it is that they’re getting wrong, and how to derail their mistakes in my own team and workflows.

Re:NPM proxy users receiving ERR 418 I'm a teapot by hinkley on Tuesday May 29, 2018 @12:15PM (#17180484)
I’m two bug fixes away from strongarming my team into moving to yarn. Npm.org needs an io.js sized attitude adjustment. The number of showstopper bugs in the last five releases is fucking bullshit.
Re:NPM proxy users receiving ERR 418 I'm a teapot by pmlnr on Tuesday May 29, 2018 @04:21AM (#17177307)
> Package management is hard.

and this is why writing yet another package manager instead of gradually improving existing ones - rpm, deb, etc. - is far from ideal.

Re:NPM proxy users receiving ERR 418 I'm a teapot by TheCoreh on Tuesday May 29, 2018 @05:21AM (#17177628)
rpm and deb are tied to specific operating system distributions, and are also meant to install packages globally on a system. npm, on the other hand, is meant to be cross-platform and is primarily focused on installing dependencies on a per-project basis. Its rules for lookup, matching, deduplication etc are mostly defined or informed by Node.JS conventions. I don't think apt or rpm would be willing to cover these use cases, and even if they did, it would probably not be worth it
Re:NPM proxy users receiving ERR 418 I'm a teapot by LoSboccacc on Tuesday May 29, 2018 @05:37AM (#17177694)
the maven model has worked quite well so far.
Re:NPM proxy users receiving ERR 418 I'm a teapot by codefined on Tuesday May 29, 2018 @08:51AM (#17178648)
I'm not sure if it's a model thing or just that software has bugs, but lots of people really dislike Maven. Not sure it's an example of a good package manager.
Re:NPM proxy users receiving ERR 418 I'm a teapot by peeters on Tuesday May 29, 2018 @10:23AM (#17179385)
Do they hate the package management or the build tool? Maven introduced a new package format (the Project Object Model, pom.xml) at the same time as introducing a very declarative build tool.

The really confusing part is that the two are conflated by design: if building with Maven, your project's pom.xml also contains the declarative Maven configuration used to build your package, instead of containing just the package metadata (name, dependencies, etc). But that's not required, and it need not be part of the *.pom XML file deployed in the published package.

Since release, many build tools have been introduced that can consume and produce POM-compatible packages but don't require you to use Maven itself as your builder (Ivy for Ant, gradle for writing build scripts in Groovy, SBT for Scala, etc).

Re:NPM proxy users receiving ERR 418 I'm a teapot by _asummers on Tuesday May 29, 2018 @01:29PM (#17181212)
Just a note: you can use Gradle for Java too. I haven't built a Java project without Gradle since like 2010 or so.
Re:NPM proxy users receiving ERR 418 I'm a teapot by peeters on Tuesday May 29, 2018 @01:55PM (#17181454)
Yeah sorry if I wasn't clear, in Gradle the build script is written in Groovy. It is used to build any number of project types.
Re:NPM proxy users receiving ERR 418 I'm a teapot by vorg on Tuesday May 29, 2018 @04:10PM (#17182547)
Gradle build scripts can also be written in Kotlin.
Re:NPM proxy users receiving ERR 418 I'm a teapot by tlarkworthy on Tuesday May 29, 2018 @12:32PM (#17180672)
I spent yesterday trying to get protobuffers working in maven, see http://vlkan.com/blog/post/2015/11/27/maven-protobuf/ for the pain.

Anything counter to maven's way is a PITA. In this case, Maven dislikes platform specific binaries.

Re:NPM proxy users receiving ERR 418 I'm a teapot by jrs95 on Tuesday May 29, 2018 @09:30AM (#17178961)
The CLI is among the least intuitive I’ve ever used, and pom.xml is pretty verbose and complex. That being said, it works very well and I’ve never had a problem with it (other than it’s aesthetics) after grokking it.
Re:NPM proxy users receiving ERR 418 I'm a teapot by realusername on Tuesday May 29, 2018 @10:13AM (#17179319)
Technically yes, on the usability part there's still a long way to go...
Re:NPM proxy users receiving ERR 418 I'm a teapot by pmlnr on Tuesday May 29, 2018 @08:57AM (#17178690)
> globally on a system

In the world of containers? Come on.

Re:NPM proxy users receiving ERR 418 I'm a teapot by solatic on Tuesday May 29, 2018 @09:05AM (#17178747)
You understand that you can install a deb/rpm inside a container, right?

The conservation of complexity is at play here. Either you have a quasi-complex deb/rpm, and a simple Dockerfile with a RUN command installing it, or you have a quasi-complex Dockerfile which does all the packaging work itself.

Re:NPM proxy users receiving ERR 418 I'm a teapot by pmlnr on Tuesday May 29, 2018 @11:04AM (#17179759)
> You understand that you can install a deb/rpm inside a container, right?

That's exactly why I replied. deb/rpm in container is a reasonable choice, and that way, they aren't global for the system but local in the container.

Re:NPM proxy users receiving ERR 418 I'm a teapot by dEnigma on Tuesday May 29, 2018 @05:11AM (#17177576)
Unless the existing ones would require radical changes to realize your vision, which would be hard to do in a gradual manner and probably lead to more problems than just writing something from scratch.
Re:NPM proxy users receiving ERR 418 I'm a teapot by JepZ on Tuesday May 29, 2018 @06:52AM (#17177963)
Well, package management often starts too simple. Sadly, most people who build new ones seem to ignore the lessons from earlier projects. In my opinion, Paludis/Cave [1] is a decent example of which cases have to be handled, but as it uses the ebuild/exheres system it is slow as hell. The user experience isn't that good either, but at least they know how to do proper dependency management (e.g. keeping the system as stable as possible during updates by using a reasonable order).

For anybody who wants to build a package manager I highly recommend to take a look at what Paludis does (not necessarily how they do it).

[1]: https://paludis.exherbo.org

Re:NPM proxy users receiving ERR 418 I'm a teapot by filmor on Tuesday May 29, 2018 @09:30AM (#17178959)
I didn't use cave, but I remember using Paludis instead of Portage on Gentoo about 15 years ago, and it was really really fast at the actual package management tasks. The builds themselves take time of course, and especially for smaller packages the "./configure" part is infuriating, but that's nothing a package manager can fix.
Re:NPM proxy users receiving ERR 418 I'm a teapot by JepZ on Tuesday May 29, 2018 @01:11PM (#17181050)
In comparison to Portage it is fast, but I wouldn't consider Portage a benchmark ;-) and if you compare Paludis with Apt/Yum/Pacman and the likes it is still very slow (e.g. comparing installing binary packages).

The comparison isn't completely fair, as Paludis has a much better dependency resolution algorithm (in terms of quality), but I think the main difference comes from the package format. Ebuilds/exheres are Bash scripts which need to be evaluated in order to obtain basic information like for example build- or run-time dependencies. So to find out which packages should be updated, Paludis has to evaluate a few thousand bash scripts while other package formats allow much quicker algorithms.

Cave is just a newer front-end for Paludis which improves the user experience a bit, but the Performance should be pretty much the same.

Re:NPM proxy users receiving ERR 418 I'm a teapot by digi_owl on Tuesday May 29, 2018 @11:11AM (#17179851)
> Sadly, most people who build new ones seem to ignore the lessons from earlier projects.

This applies to FOSS in general, and then some...

Re:NPM proxy users receiving ERR 418 I'm a teapot by jonny_eh on Tuesday May 29, 2018 @12:40PM (#17180752)
I suspect that the problems NPM face are not qualitatively different from other similar systems but NPM is far larger so gets a lot more press.
Re:NPM proxy users receiving ERR 418 I'm a teapot by repolfx on Tuesday May 29, 2018 @03:11PM (#17182105)
No. The Maven ecosystem is also massive and I don't remember the last time I heard about problems with it.
Re:NPM proxy users receiving ERR 418 I'm a teapot by dawnerd on Monday May 28, 2018 @10:49PM (#17176116)
Last couples weeks especially. Packages being published but not updated on the main registry. Super super frustrating.
Re:NPM proxy users receiving ERR 418 I'm a teapot by xab9 on Tuesday May 29, 2018 @02:10AM (#17176853)
Since they introduced package locks `npm i` breaks way too often for us (we have win-mac-linux machines), it's a royal pain in the back.
Re:NPM proxy users receiving ERR 418 I'm a teapot by abritinthebay on Tuesday May 29, 2018 @11:51AM (#17180234)
Your packages break when installed from a lock file...?
Re:NPM proxy users receiving ERR 418 I'm a teapot by xab9 on Tuesday May 29, 2018 @01:51PM (#17181422)
`npm i` breaks. Then we delete the lock file (and usually node_modules), run npm i again and it works. Probably it works for you and we are just unlucky or we were too lazy to use some cli magic, dunno. Yarn people here (at the company) usually say that yarn worked for them better, can't clarify about that.

One time out of fun and curiosity we flushed the cache and deleted the lockfile and the node modules dir, did npm i on a mac and a windows and they were undiffably different. Okay, this was months ago and probably there is a good explanation for it, but it was not reassuring.

Re:NPM proxy users receiving ERR 418 I'm a teapot by abritinthebay on Thursday May 31, 2018 @02:50PM (#17198958)
Yarn breaks things all the time for me. Practically every build process issue I’ve had in the last 7 months has been Yarn related.

Never had `npm i` break though... does it fail if you do `npm ci`? Are you pinning versions? Very peculiar behavior.

Re:NPM proxy users receiving ERR 418 I'm a teapot by xab9 on Friday June 01, 2018 @02:15AM (#17202989)
Didn't try it, but I will, thanks.
Re:NPM proxy users receiving ERR 418 I'm a teapot by swyx on Monday May 28, 2018 @10:40PM (#17176080)
what else in these "past few months" are you referring to? as a moderate npm user i am blissfully oblivious.
Re:NPM proxy users receiving ERR 418 I'm a teapot by jwalton on Tuesday May 29, 2018 @12:24AM (#17176486)
In the past few weeks:

* NPM 6 stopped working with Node 4. Rather than actually fix it, they just left it broken for several days because it was already fixed in the upcoming release, and I guess they didn't want to do an emergency release: https://github.com/npm/npm/issues/20716

* There was a several hour period where you could publish packages, but then they would 404 when you tried to download the new version.

* They switched to using Cloudflare on Friday, and broke Yarn in the process: https://mobile.twitter.com/jamiebuilds/status/10001984632696...

* Somehow while switching to Cloudflare they blew away a bunch of the packages that had been published during the previously mentioned window. They also blew away all the versions of some packages. Last Friday night you couldn't 'npm install gulp'. Never gave any explanation for this: https://github.com/npm/npm/issues/20766

About a month ago there was a bug where npm would change permissions on a bunch of system files and render you entire system unusable in you ran it as root. But that was OK because the bug was on the "next" version of npm, not the one you'd get by installing 'npm install -g npm'... Except there was also a bug in the current version of npm that installed the next version of any package by default, so it did in fact blow up a bunch of machines.

Now, apparently, they are a teapot.

Re:NPM proxy users receiving ERR 418 I'm a teapot by bartread on Tuesday May 29, 2018 @02:36AM (#17176938)
And the real problem with all of this is that npm has become so ubiquitous that you can't get away from it if you're doing client side development (not even by switching to yarn).

You simply have to endure it, and accept that every now and again, for reasons entirely beyond your control (and at a quite possibly very inconvenient moment) it's going to break.

This really annoys me, but what can one do? At least it's fixed now.

Re:NPM proxy users receiving ERR 418 I'm a teapot by flipp3r on Tuesday May 29, 2018 @02:58AM (#17177017)
> This really annoys me, but what can one do? At least it's fixed now.

Install your own repository manager? This is the standard in every company I've worked for so far, at least in the Java world. Artifactory supports NPM, so set it up as a proxy.

Re:NPM proxy users receiving ERR 418 I'm a teapot by akatechis on Tuesday May 29, 2018 @02:40PM (#17181867)
We use ProGet with npm, docker and nuget feeds. We only ever hit the internet when we install fresh dependencies. After that, they get cached on our local service for all developers and machines to consume. That, coupled with yarn itself, which caches dependencies locally as well so subsequent installs don't even go out to the network, has accelerated our build times considerably.
Re:NPM proxy users receiving ERR 418 I'm a teapot by bartread on Tuesday May 29, 2018 @03:08AM (#17177059)
That's interesting - thanks. Of course, it has a price tag, but so does the rest of our pipeline, along with our time.
Re:NPM proxy users receiving ERR 418 I'm a teapot by PebblesHD on Tuesday May 29, 2018 @03:50AM (#17177189)
As far as the monetary price of implementing such a system, Nexus OSS[1] also supports NPM proxying and is free for basic usage.

[1] - https://www.sonatype.com/nexus-repository-oss

Re:NPM proxy users receiving ERR 418 I'm a teapot by zamber on Tuesday May 29, 2018 @10:11AM (#17179306)
We have Nexus in a subnet for faster installing. We had to write scripts porting over lockfiles from npm to nexus and back.

This had to be added to a precommit hook to not break CI. Seriously, package.json should allow to specify what endpoints should be used if available in a given order. Now it's up to each dev team to handle.

My main concern is that it's brittle. Nexus caches exact versions and nothing more so we don't even have assurance that it will work nicely when NPM goes down.

On the other hand lockfiles are awesome. I missed them back in 2012... copying over node_modules on USB drives was not cool.

Re:NPM proxy users receiving ERR 418 I'm a teapot by acejam on Tuesday May 29, 2018 @12:46PM (#17180806)
You can specify what registry to use with a simple project-based .npmrc file. We have ours point to our Nexus npm proxy.
Re:NPM proxy users receiving ERR 418 I'm a teapot by zamber on Tuesday May 29, 2018 @03:26PM (#17182213)
That's what we eventually do but the lockfiles don't care, a resource url is a resource url. We use yarn too which does proxies only in .yarnrc IIRC.

Do you have an externally available Nexus? Using ours through a VPN beats the main purpose - fast(er) installs. That's why for WFH scenarios we have a script to switch between our proxy and NPM.

Re:NPM proxy users receiving ERR 418 I'm a teapot by acejam on Tuesday May 29, 2018 @04:12PM (#17182568)
Our Nexus setup is internal only. For WFH, we have hundreds of folks using a corporate VPN which routes to our office, and then our office routes to our AWS VPC, which is where our Nexus installation lives. I set this configuration up and haven't had any real issues with it, nor do I see any reason to switch between a proxy and npm.

If a developer is using an older buggy version of npm that doesn't respect .npmrc and changes a lock file to point back to npmjs.org entries, we deny the PR and ask for it to be fixed. Right now that check is unfortunately manual, but there are plans to automate it. It can be easy to miss at times though, since GitHub often collapses lock files on PR's due to their size.

For us, the main purpose of using Nexus as a proxy is to maintain availability and to cache/maintain package versions. If you're using Nexus to make things faster, then you probably shouldn't be using it. If you want faster installs, look into using `npm ci`.

Re:NPM proxy users receiving ERR 418 I'm a teapot by solatic on Tuesday May 29, 2018 @12:06PM (#17180403)
Nexus OSS can't be clustered / put in a highly-available install, which is a paid feature for Nexus.

To ensure that you're actually deriving benefit from your Nexus install, you have to block outbound connections to the NPM public registry from your CI build agents (if you don't firewall it off, you don't want to wake up one day and find that both origin and the proxy are erroring because your proxy never actually cached anything and you never tested tested your proxy... right?), with only the Nexus installation permitted to make such outbound connections. And as bad as NPM may be, there are real maintenance costs to running your own Nexus install (not least of which, managing updates that will take Nexus down and communicating them with your dev team so that CI builds which error out when Nexus is down can be restarted when it goes back up), and thinking that you can do better than NPM is hubris. Running a private Nexus OSS install for the purpose of trying to increase availability for low cost (not zero - you still have to pay the infrastructure costs) is usually a false economy.

If you work for a company with enough operations and infrastructure resources that adding a clustered install is trivial, then you probably have enough resources to pay for an Artifactory license.

TL:DR - NPM has its faults but it's still probably de-facto both more available and better updated than taking on the responsibility of running a proxy unless you have mature ops/infra teams

Re:NPM proxy users receiving ERR 418 I'm a teapot by actionowl on Tuesday May 29, 2018 @06:46AM (#17177945)
This one is free, we use it and it works for our needs. We also have it integrated with our Active Directory: https://www.verdaccio.org/
Re:NPM proxy users receiving ERR 418 I'm a teapot by grumblestumble on Tuesday May 29, 2018 @02:02PM (#17181526)
We use Verdaccio and I can't imagine any serious dev shop not using some kind of proxy / private registry for NPM packages. It's really simple to set up and has served us well, aside from minor hiccups.
Re:NPM proxy users receiving ERR 418 I'm a teapot by madeofpalk on Tuesday May 29, 2018 @08:49AM (#17178626)
Sinopia was used at a previous job https://github.com/rlidwka/sinopia
Re:NPM proxy users receiving ERR 418 I'm a teapot by jasonjayr on Tuesday May 29, 2018 @10:06AM (#17179257)
Just to save other users some time, it seems like sinopia is no longer maintained, and doesn't work on Node 8

https://github.com/rlidwka/sinopia/issues/456

Verdaccio, mentioned in a sibling comment seems to be the recommended replacement ...

https://github.com/verdaccio/verdaccio

Re:NPM proxy users receiving ERR 418 I'm a teapot by achamayou on Tuesday May 29, 2018 @03:53AM (#17177204)
The OSS edition of Nexus supports npm proxies. Sure there’s a little bit of setup, but it will more than pay for itself the first time an event like this one occurs.
Re:NPM proxy users receiving ERR 418 I'm a teapot by acejam on Tuesday May 29, 2018 @12:52PM (#17180872)
Agreed. It's very easy to setup a private npm registry using Nexus OSS.
Re:NPM proxy users receiving ERR 418 I'm a teapot by TheAceOfHearts on Wednesday May 30, 2018 @05:45AM (#17186357)
As others suggested, any serious deployment should be hosting their own registry / mirror or using a paid service. This also saves you in cases such as the left-pad issue, as your mirror would still have the package. It is unwise to rely on free third-party services which are out of your control, especially for something as important as deployment!

This problem is not limited to npm. I remember a few years back there were similar issues with RubyGems, where it'd go down leaving many developers unable to deploy.

Heck, how many projects do you think would be left unable to deploy if GitHub went down? I remember a few years back they'd have their occasional issues and Twitter would become a storm of angry developers.

For many projects not being able to deploy or develop at any moment, as well as dealing with left-pad style issues is implicitly accepted as a reasonable trade-off.

Re:NPM proxy users receiving ERR 418 I'm a teapot by krapp on Wednesday May 30, 2018 @06:26AM (#17186499)
>This really annoys me, but what can one do? At least it's fixed now.

The weird thing is, open source development is as close to a free market as one can get. Frustration with NPM should result in multiple javascript package managers competing to undermine NPM's dominance, but the only alternative is one that uses the Node registry.

Re:NPM proxy users receiving ERR 418 I'm a teapot by Arnavion on Tuesday May 29, 2018 @02:43AM (#17176963)
Vendor your dependencies, or host clones on infrastructure that you're responsible for.
Re:NPM proxy users receiving ERR 418 I'm a teapot by bartread on Tuesday May 29, 2018 @03:02AM (#17177031)
Vendoring isn't ideal: it makes, for example, code-reviews a PITA, and you still have the problem of what to do when you upgrade or add a dependency. Then you're back to npm (or yarn). Granted, at much reduced frequency, but it's still there.

Maybe we'll go down the clone route if the cost of npm issues becomes too high relative to the hassle and expense of maintaining our own.

Re:NPM proxy users receiving ERR 418 I'm a teapot by krapp on Wednesday May 30, 2018 @06:20AM (#17186482)
>Vendoring isn't ideal: it makes, for example, code-reviews a PITA, and you still have the problem of what to do when you upgrade or add a dependency.

The status quo in which anything that goes wrong breaks the entire universe because no one vendors is also not ideal.

However, consider the long list of disasters that have occurred with NPM recently, and how many of them would have been less disastrous had vendoring been the exception rather than the rule. Left-pad wouldn't even have been an issue, for example - builds simply would have been unable to update, but nothing live would have been affected.

To misquote Ben Franklin here, the tradeoff isn't between a greater ideal and a lesser ideal, but between security and convenience.

Re:NPM proxy users receiving ERR 418 I'm a teapot by acemarke on Tuesday May 29, 2018 @12:48PM (#17180830)
That's why I really like Yarn's "offline mirror" feature. It lets you cache the tarballs themselves locally. There's also a tool called `shrinkpack` that lets you do the same when working with NPM itself, but I'm not sure if it works right with NPM5/6.

I wrote a post a while back about using Yarn's offline mirror: http://blog.isquaredsoftware.com/2017/07/practical-redux-par...

Re:NPM proxy users receiving ERR 418 I'm a teapot by numbsafari on Tuesday May 29, 2018 @08:20AM (#17178430)
One way to keep vendoring from causing nightmare code reviews is to keep updates to vendored components in their own release/branch/PR. Yes, there will be changes to your code to accommodate the updated packages, but it keeps it very focused so that the code review isn’t also trying to evaluate updates to business rules or functionality.

If you are updating components along with business rule updates, then, yes, it’s going to complicate code review, regardless of vendoring.

Re:NPM proxy users receiving ERR 418 I'm a teapot by acejam on Tuesday May 29, 2018 @12:55PM (#17180900)
Vendoring dependencies typically entails committing at least 200-500 MB of packages into a git repo. No thanks. Availability should be easy to control with running your own Nexus or other internal registry. The rest (package versions, etc) can often be solved with an npm 5+ lock file.
Re:NPM proxy users receiving ERR 418 I'm a teapot by ino on Tuesday May 29, 2018 @04:14AM (#17177284)
> you can't get away from it if you're doing client side development (not even by switching to yarn).

Explain yourself better or top spreading this nonsense. What do they give you that you couldn't develop without them?

Re:NPM proxy users receiving ERR 418 I'm a teapot by pcx on Tuesday May 29, 2018 @04:22AM (#17177310)
This is true. The case I encountered was, you cannot install `aws-sam-local` with yarn, you will need npm to do the install.
Re:NPM proxy users receiving ERR 418 I'm a teapot by tedivm on Tuesday May 29, 2018 @02:28AM (#17176915)
I don't think it's fair to blame them for breaking yarn. The way yarn setup their "mirror" url and the way Cloudflare handles account security conflicted and broke down yarn. I really don't see how any team could have seen that coming, or how they should be responsible for people making creative use of their infrastructure.

Everything else is legit though.

Re:NPM proxy users receiving ERR 418 I'm a teapot by mort96 on Tuesday May 29, 2018 @03:23AM (#17177095)
Well, they could have though, "Will this large infrastructure change affect any of the tools which depend on our infrastructure?", set up a small test system using cloudflare, and then test a few tools (like Yarn) against the new system.
Re:NPM proxy users receiving ERR 418 I'm a teapot by __s on Tuesday May 29, 2018 @03:47AM (#17177183)
https://github.com/harthur/nomnom/issues/81

nomnom is no longer maintained, so npm takes the project over, & makes a 2.0.0 update which is empty besides a README saying it's deprecated. Which breaks some packages which have a '>=1.2' version. So npm deletes 2.0.0. Which breaks for people who have had their package.json update from 2.0.0. Even when they'd had a system working with 2.0.0 (not even using nomnom, just a depedency of a dependency for the commandline portion that isn't being used) & were ready to deploy

In Rustland you can't publish a crate with '>=1.2' dependencies

Re:NPM proxy users receiving ERR 418 I'm a teapot by steveklabnik on Tuesday May 29, 2018 @05:49AM (#17177751)
I’m pretty sure you can, I thought we only outlaw *.
Re:NPM proxy users receiving ERR 418 I'm a teapot by losingthefight on Monday May 28, 2018 @10:47PM (#17176104)
Not OP but maybe he is referring to the big in which the npm upgrade bumped to a non-ready version and caused havoc on production systems by overwriting permissions and files: https://github.com/npm/npm/issues/19883

That was the end of February, so not sure but that may be it.

Re:NPM proxy users receiving ERR 418 I'm a teapot by jjeaff on Monday May 28, 2018 @10:56PM (#17176145)
There was also the issue where npm filter bots accidentally expelled some large, legitimate users and then made the namespace available, thus allowing random people to take the packages over, and inject code into any applications that used those projects.
Re:NPM proxy users receiving ERR 418 I'm a teapot by erichurkman on Tuesday May 29, 2018 @12:18AM (#17176464)
This is one of the scariest aspects to modern development. Thousands of applications are one bad actor away from ruin. We're incredibly vulnerable. Chrome extension gone rogue? Package repository allowed duplicate packages? A contributor's GitHub key was hijacked?

Imagine uBlock Origin's Chrome extension author creds were hacked. "He" publishes a new version of the Chrome extension that monitors coinbase.com and fakes the transfer/confirmation screen, or submits transfers in the background. The extension has "write" access on all sites, so the rogue extension can also monitor your Gmail and silently inject a filter that routes trade confirmations to trash.

Or the "requests" library in Python gets an update to replicate 2FA codes via Twilio to a 3rd party.

Sure, you can do pinning and cryptographic signatures to verify that v 1.0.0 of X is really what you expected.

But who audited 1.0.0 of X in the first place...?

Re:NPM proxy users receiving ERR 418 I'm a teapot by xab9 on Tuesday May 29, 2018 @02:13AM (#17176863)
My thoughts exactly.

We are one step away from very bad shit hitting the fan in a very painful way... so let's pretend everything's fine and try not to think about these things.

Re:NPM proxy users receiving ERR 418 I'm a teapot by nkuttler on Tuesday May 29, 2018 @12:07AM (#17176416)
When a production system pulls "latest" of anything, such things are bound to happen. There probably is no reliable testing or QA either when deployment methods are not deterministic.
Re:NPM proxy users receiving ERR 418 I'm a teapot by da_chicken on Monday May 28, 2018 @11:41PM (#17176299)
Whenever I see NPM I think of the left-pad debacle and the more recent is-odd issue:

https://www.reddit.com/r/programming/comments/886zji/why_has...

Re:NPM proxy users receiving ERR 418 I'm a teapot by 2muchcoffeeman on Tuesday May 29, 2018 @06:53AM (#17177967)
From the link:

So in case you weren't aware: If you're using webpack, you're using is-odd. Which itself relies on the excellent package is-number.

So, how and why did the developers let things get this bad?

Re:NPM proxy users receiving ERR 418 I'm a teapot by kbenson on Tuesday May 29, 2018 @01:12PM (#17181060)
I think there's a feedback loop in the JS ecosystem where the desire for smaller file sizes and the ability to pare down the fluff around a packaged function in webpack/whatever incentivize lots of small single purpose modules.

If you care about the size of the code you are delivering then it makes sense to skip some larger math/numerics library and instead opt for is-odd, which itself includes is-number.

Unfortunately, when the authors of modules also do this and not just end users, it becomes hard to track down how much a dependency actually adds, and the chain of dependencies can get very deep. Once that chain is deep we lose the ability to easily determine how a change the complex system we now rely on.

And that's all really at a surface level. Once we start talking about trust and security, the problem gets much worse.

Re:NPM proxy users receiving ERR 418 I'm a teapot by 2muchcoffeeman on Tuesday May 29, 2018 @05:14PM (#17182963)
Couldn’t this just be done at transpilation time?
Re:NPM proxy users receiving ERR 418 I'm a teapot by throwaway66666 on Tuesday May 29, 2018 @03:13AM (#17177073)
I have a (conspiracy) theory, that JS developers bribe and pay each other to include their projects as useless NPM dependencies, so they can rack up downloads and go to the next employer with a

"My package has 2 million downloads, I want x% more than market rate" attitude.

It's like the equivalent of influencer marketing, but for code packages. Of course I could just be a crazy old man. Who knows?

Re:NPM proxy users receiving ERR 418 I'm a teapot by BigJono on Tuesday May 29, 2018 @05:34AM (#17177682)
I don't know if they bribe each other, but there's definitely a lot of people shilling garbage libraries because they have income streams dependent on it. Certain people here have alerts set up for certain topics so they can come in and astroturf. You'll be able to spot them if you keep a look out for it.

They specifically target noob questions/discussions, post links to their blogs that talk about certain dependencies. The articles themselves have very little substance, they're full of buzzwords and spend all their words making ambiguous claims, for example they'll say that the dependency makes your code "scale", but won't give any examples from a large code-base, especially not any comparing to the alt case (without the dependency). They make claims about performance, but don't elaborate, don't show benchmarks (or the'll show benchmarks that don't apply to 99% of projects, kind of like how immutableJS is obviously not faster unless you're working with big data structures, which you almost never are in your standard CRUD app where everything is paginated server side).

This shit is everywhere, and there's a lot of people with a vested interest in making sure these tools propagate as much as possible.

Re:NPM proxy users receiving ERR 418 I'm a teapot by woah on Tuesday May 29, 2018 @09:38AM (#17179029)
Spill the beans! What are these blogs ? Or are you afraid of retribution from this shadowy cabal?
Re:NPM proxy users receiving ERR 418 I'm a teapot by exikyut on Tuesday May 29, 2018 @10:02PM (#17184448)
I have seen very few examples of what you describe, if any at all. I wouldn't rule out the possibility that this is because I've missed them, and I certainly wouldn't mind getting a few clues/pointers.
Re:NPM proxy users receiving ERR 418 I'm a teapot by throwaway66666 on Wednesday May 30, 2018 @06:40AM (#17186541)
My comment above (about the bribery) was a joke. I am surprised that people took it at face value.

But no matter the joke, in no other language you 'd see packages like "is-true", "is-false", "ifAnd" (because && is too difficult /s) and "ifOr" (because... what's that "ll".... wait, is it "II" ? Um... How do I type it that vertical || line thing again?? /s).

The problem is not with users creating "useless" packages, the problem is with the community embracing them and having completely redundant one-liners gather million of downloads every week.

It just feels... icky. As if the whole's thing is put together with duct tape and bubble gum. We didn't resort to these kind of things when we had to support IE5.5 and 6. What went wrong from 2010 till today?

Seeing "is-true" rely to "is-object"... Why? Seriously, why? Maybe I am being completely narrow-minded and bitter.

If that is so please teach me and I 'll try to be better. I am not trying to provoke only to learn.

Re:NPM proxy users receiving ERR 418 I'm a teapot by exikyut on Wednesday May 30, 2018 @08:13PM (#17192992)
Not your fault, I'd say a good percentage of people here aren't great at reading tone, on top of how terrible text is at conveying tone in general. I definitely read the tone wrong :)

I think it's easier to answer in reverse order. DISCLAIMER: This is part rant, part "projected-constructed worldview". I absolutely welcome balloon-popping and "that's absolutely not true" and pointers to things that debunk/disprove points, so I can have a proper idea of history, and a better personal idea of the way things are.

First of all: the Web is "new media". Yep, fussy annoying buzzword; but one that has some truth to be discovered in it.

The position/power/operations/general relevancy of companies like Google, Mozilla, Facebook, Amazon, etc, more closely resembles that of CNN, Fox, CBS, Disney, etc around the 1995-2002 timeframe, than AT&T, AOL, CompuServe, Verizon, Comcast, etc, in the same time period. These modern companies have taken up the slack of the old TV/cable media empires of recent yesterdecades.

The Web has taken the place of TV, not by replacing it, but by becoming the new media focus.

It's a bit of a good side-illustration to mention that the Web is the perfect example of something with "Shiny Actually-New Thing Which Seriously Truly Isn't Anything Like What Came Before It" syndrome, for exactly the reason I mentioned in italics - the Web, for most people, resembles nothing like TV.

I think one reason for this is the technological generation gap: older people don't fluidly relate to computers, while the younger generation don't have quite the same perception/appreciation of non-interactive TV that their elders do, so while there is some collective conversation about media agendas, it doesn't bridge the generational divide that coincidentally happened with TV>Internet, and so people don't realize the _exact same_ control agendas that went into TV now go into the Web.

But technical folks who've seen the Web grow, and change, wonder: what's happening? My working theory is that the technical changes we're seeing stem from various upstream political machinations within media.

So, to the 2nd half/2nd question. As a "new media" company, Google wants to retain captive control of as much as possible, in exactly the same way $oldmedia would. So what do they do?

Well, back in the 80s and 90s you'd run cable to the entire country to control distribution, cultivate deals and negotiations with advertisers and producers, etc etc. See Also: CNN/MSN/MSNBC/CNBC (I never did figure out what acronyms went where with those companies), Comcast (which I understand doesn't just provide garbage cable/DSL internet, but is also a TV and media network), Time Warner, etc.

So, nowadays, Google's pretty much nailed the advertising thing, undoubtedly to the chagrin of everybody else. On top of that they handle the world's searches - and you never lie to a search engine (!), and that's the world's biggest non-perceived captive audience ever right there.

But they're GOOG; they legally have to vacuum up as much of everything that everyone's perception of them supposes is within their purview, in order for the balance sheets to look right. That most definitely includes Web standards. So, how do you control Web standards?

Well, you apparently approach your cofounder and say you need to build a browser.

I wonder what the friction breakdown was - how much political, how much technical - when Google split with Apple working on WebKit, and forked/created Blink. Heh, I'll never know. But the commit rate sadly plummeted after the fact (http://mo.github.io/2015/11/04/browser-engines-active-develo...) so code quality certainly wasn't on the decision table; something else was the priority. My guess is that it was straightforward market dominance, and competing against WebKit (and iOS!).

So, (having won) one Internet (marketshare) later, now what? Well, now you have a browser, you can play in the "democratic browser vendor" sandpit as a first-class citizen! The Standards® Committees™ are full of people who absolutely love discussing Web minutae all day; all you have to do is fund conferences and shows for them to attend, and they'll go ahead and build their own candles to fly around. They're like the self-organizing equivalent of https://xkcd.com/356/, it's wonderful.

They do need feeding though; specifically, you need to feed them just slightly too much in terms of upstream changes, so they can almost keep up but not quite. Just on the edge of being able to manage everything though. This is easy to do by, instead of adjusting the workload slider, adjusting the paid employees slider instead; and you can indirectly do this by doing nothing to democratise/vindicate/humanize the standards managlement process at the W3/WHATWG level so it seems obscure and academic and boring; and then it won't seem intuitive for upper management to prioritize funding for it, and voilà.

Now you just need to find a good source of chaos to keep everybody on their toes. You do this by investing heavily in coming up with new ideas for the standards committees to implement, keeping careful track of what everyone's discussing, and prioritizing what to carefully drop quietly on the floor ("oh yes we do need to get back to that sometime sorry about that") and what to react to as an interested browser vendor. Be polite enough about other vendors' technical interests, of course; your market share will typically dictate what'll actually get maintained at the end of the day. Pick things to cooperate on to keep everything looking democratic, so you don't get cornered into implementing things you don't want to (if this even happens?).

Oh, regarding the democratic bent that seems to underpin everything related to the Web (and open source for that matter): I consider it all a psyop (I was recently reminded of the existence of this sort of thing by https://news.ycombinator.com/item?id=16918752). Focusing on social organization (and justice and related fields, FWIW) are excellent ways to sink/drain massive amounts of energy; get humans into that loop and they don't seem to be able to disentagle themselves thanks to peer pressure and the precedence that gets created. (This is why "minority groups", typically the gender-focused ones, are in the permanent media spotlight - it allows control.) Democracy is a foundational part of the US Constitution, so of course democratic leadership is a very politically correct way to do "high-level" "important" things like directing the future of the Web; on top of that, democratic "leadership" is the kind of thing most people see straight through unless someone pokes the hologram the right way (especially when everyone's preoccupied with getting their social dance moves right), so I can easily see it being used as a tool in situations like this.

In the case of Web standards groups it was particularly easy to deploy "democratic leadership" - the Web groups seem to have been engaged in a most fascinating set of caricatured circling/courting "everyone's voice is important" dances since time immemorial. I was enlightened about the historical state of the Web a couple years ago: https://news.ycombinator.com/item?id=10684426 (I accidentally locked "i336_" by setting "showprocrast" too high, woops). Besides the antitrust bits I commented on, I've also since learned that IE6 implemented an early draft version of the DOM (or it could have been the CSSOM) before it got redesigned from scratch, then the necessary reimplementation work was never approved, and this was the source of all the rendering bugs. (I need to go re-find that link, sorry!)

Reading through those mailinglist posts showed me that the various Web working groups have always been... I'll say it, somewhat stuffy, and this fact is not a new development. It's sadly so easy to psyop-weaponize though (or, in any case, the baseline likelihood that this has happened is so incredibly far away from absolute zero...), as per the xkcd I mentioned before. Meanwhile, you carefully build EME behind the scenes (the implementation of which is kinda depressing; see zb3's reply to https://news.ycombinator.com/item?id=15796420).

Unfortunately some people run off and actually go and make interesting and amazing things in the face of great odds, for example https://codepen.io/AmeliaBR/post/me-and-svg (<> https://news.ycombinator.com/item?id=14155393). It seems those who stubbornly want to succeed are handled by ignoring them and hoping they'll go away. Or - https://en.wikipedia.org/wiki/Hanlon%27s_razor - maybe it's that whoever it is is calling the shots is so laser-focused all they have is perfect indifference since these cool things not within the scope of their media/other agenda. An intersection of explanations is valid. But the features these amazing people come up of course get used in any case, IMO without due acknowledgement too.

Most Web developers seem to get caught up in the entropy and chaos of continual change and development, get blind{sid}ed by it, and don't really [get the chance to] form a foundation strong enough to get them out of the slipstream, looking far afield, and doing something different and unique. Commercialism and existential "must have a job to eat" probably has a big part to play in folding in to this, along with mental health impacting society's ability to think clearly, along with all the other issues the various in-vogue generations apparently focus on.

To do one of those zoom-from-outer-space-into-a-tiny-backyard things and zoom/focus from this wide view into NPM packaging, I actually argue that the state of the JS ecosystem is easily explainable by saying that the Web doesn't have a standard way to do libraries, so everyone solves that problem by vendoring (including/bundling) everything they use. This solves everything for Node.js and the browser.

> Continued >

Re:NPM proxy users receiving ERR 418 I'm a teapot by exikyut on Wednesday May 30, 2018 @08:13PM (#17192994)
> Continued >

Fundamentally, on the ground, you're looking at economy of scale, both in terms of implementational scale and in terms of humanity collectively responding to a problem and scale and slowly annealing (if I can borrow that from "simulated annealing") toward a solution that just happens to work. The macro level works out; the micro level looks terrible. Such is how this kind of thing works out; social scale/crowd dynamics are _really_ fascinating to watch at work.

Node.JS happened, so suddenly JavaScript needs to run on servers and in browsers, and handle backend (Databases! Legacy stuff! FoxPro! How To Port Your Visual Basic Excel Macro To JavaScript! I just found two libraries for RS485!), along with frontend (Win32 event loop inspired Rube Goldberg machines!), and everything in between (......uhhhh...... all of GitHub?). The ecosystem and infrastructure - all the library code - has to be compatible with everything and everything else, across more domains than I even realized existed until I thought this through 5 minutes ago. The easiest way to work in the browser and also work on the backend apparently is to fragment everything out, because nobody's come up with a better way to stdlib JavaScript. The jQuery-esque approach of "this system works unbelievably well within its problem domain but doesn't generalize" effectively died when jQuery aged beyond its point of relevance - and because the plugin system was so locked-in to jQuery, all the plugins died with it. That type of approach is very very top-heavy and simply didn't scale. It made sense when all we had was browser [delivery] though, backend types hadn't gotten their mitts over everything and made compilation pipelines for everything, etc. Now that's happened, it makes more sense to `cat * > out.js` (well, in more LOC, anyway) because it just scales better.

JS feels clunky, but once you look all the way down, I feel like the vertigo actually causes things to kinda make a tiny bit more sense and fit into place a bit better. Maybe.

I find it not unreasonable to use the explanations above to justify the higher-level "why???" of the way things are.

The duct tape and bubble gum isn't JS-specific. It's endemic to all of technology. Like with media, there are vested interests in things working out certain ways with security and whatnot. (My current favorite meme of this is http://web.archive.org/web/20160409181051/http://article.gma..., and I also found https://news.ycombinator.com/item?id=17160109 the other day and that was kind of very fun to read, and I also read the other day that the NSA discovered Heartbleed "very shortly" after it "appeared" in 2012 or whenever it was, which was a TIL of its own)

And so it is that we use systems that operate at cross-purposes with how we think and incorporate high-friction impedance mismatches, and which raise the chances we'll make mistakes, which affect everyone: https://twitter.com/x0rz/status/865196993215442944, https://sites.google.com/site/testsitehacking/

The above being said, I do completely understand your frustration with using Node. I have the same gripes with PHP, which I learned ages ago and Really Really need to move off of, but it just runs so incredibly well on older hardware and has zero warmup time... like 0.2ms on my 12 year old laptop... sigh. One day I'll find something, or maybe I'll make it myself.

I'll leave you with three last links which I couldn't fit into the narrative, but which I think are relevant/related.

Firstly this an interesting article that helped me properly understand Google: https://medium.com/p/e836451a959e

Next, I wanted to call out this NNTP post from 1995 (linked from "sent out via" in the above) showing storage investments: https://groups.google.com/forum/#!topic/mail.cypherpunks/4CD...

For context about cost in the above link: I found this very cute little document while randomly manual trawling (I love finding things not in Google's index) whose HTTP headers say it's from 1996: http://users.monash.edu.au/%7e%6a%6f%68%6e%6d/%77%65%62%73%6... (#1 I don't want its filename to be indexed just yet :P and #2 I want to do an experiment to see if the crawler resolves the escapes and finds the URL anyway)

NB. If you have a better term than "new media", I'm curious. It's such an easy term to overload. The symbol picked for biohazard was designed from scratch to be meaningless so a meaning could be cultivated for/associated with it over time, and that cultivated meaning would be what "stuck". (I wonder how many other things this has happened with.) https://en.wikipedia.org/wiki/Hazard_symbol#Biohazard_symbol

NB2. If you - say - accidentally hit F5 while writing a post... and you're on Linux, suddenly get really really interested in opening Chrome's task manager, identifying the renderer PID and SIGSTOPping it in as few seconds as you can. The first ~15% of the above text was recovered via gdb generate-core-file \o/

NB2a: (For completeness, if you accidentally close the tab, have working hibernation set up, and either go fishing in the swap partition on resume, or if you don't want to risk stepping on anything in swap on reboot, carefully boot something that won't automatically swapon.)

NB3: $lists_i_am_on += 5000 :P

Re:NPM proxy users receiving ERR 418 I'm a teapot by consp on Tuesday May 29, 2018 @03:38AM (#17177155)
Having just js experience on your resume would/should not effectively result in increased pay without substantial references. Even if you have a shitload of package downloads. Downloads do not represent good code, work attitude or otherwise interesting properties for a company, as you already pointed out by stating the 'fake' downloads for a lazy engineer with lack of respect for others (by forcing dependencies with dubious benefit).
Re:NPM proxy users receiving ERR 418 I'm a teapot by techterrier on Tuesday May 29, 2018 @06:16AM (#17177857)
NPM is absolutely the worst package manager, apart from all the others I have tried.
Re:NPM proxy users receiving ERR 418 I'm a teapot by StavrosK on Tuesday May 29, 2018 @08:06AM (#17178329)
I'm pretty sure it's worse than most others I've tried.