News for hackers. Stuff that matters.
Re:Temporary fork enables Node.js to optionally use the Chak... by cmwelsh on Tuesday May 12, 2015 @03:21PM (#9534203)
Can I browse my node_modules folder in Explorer yet? [1]

[1] https://github.com/joyent/node/issues/6960

Re:Temporary fork enables Node.js to optionally use the Chak... by dyscrete on Tuesday May 12, 2015 @03:26PM (#9534237)
Wow, what's up Microsoft?
Re:Temporary fork enables Node.js to optionally use the Chak... by pionar on Tuesday May 12, 2015 @03:36PM (#9534296)
Actually, I was thinking, what's up node? Each dependency keeps a private copy of its dependencies? How messed up is that? Or am I just reading that wrong?
Re:Temporary fork enables Node.js to optionally use the Chak... by bryanlarsen on Tuesday May 12, 2015 @03:40PM (#9534324)
That's a feature, not a bug. It lets A rely on version 0.9 of X while B relies on version 0.8.
Re:Temporary fork enables Node.js to optionally use the Chak... by pionar on Tuesday May 12, 2015 @03:46PM (#9534368)
I don't call that a feature. There's other ways of doing version pinning without junking up my filesystem.
Re:Temporary fork enables Node.js to optionally use the Chak... by tdicola on Tuesday May 12, 2015 @07:16PM (#9535633)
Regardless of who is right or wrong at the end of the day it's still broken for many people. If Microsoft and Joyent/the node & npm community care about people using node & npm on Windows then the issues needs to be resolved, period.
Re:Temporary fork enables Node.js to optionally use the Chak... by ksherlock on Tuesday May 12, 2015 @04:02PM (#9534465)
Re:Temporary fork enables Node.js to optionally use the Chak... by nemothekid on Wednesday May 13, 2015 @12:11AM (#9536713)
I don't see how this npm's problem - the language itself doesn't let you catch this problem - and the pattern itself is dangerous. I'd have to agree with IsaacSchlueter here.

If I have a library (libA) that uses fooV1 and another (libB) that uses fooV2, there is no reason I should expect those two dependencies to interop with each other (except explicitly stated by the developer).

The solution (that there should be one set of dependencies) is an even worse problem that currently afflicts the Golang community, which they have decided to solve the same way npm has decided to solve it - vendoring.

Now with Golang, if you only have 1 set of dependancies, and one of your libraries depended on an older version - your program just won't compile (unless you update the library to use fooV2) and I'm not sure how thats useful to anyone. Most people will just tell you should have have just versioned that dependency.

Re:Temporary fork enables Node.js to optionally use the Chak... by spion on Wednesday May 13, 2015 @04:08AM (#9537463)
In the vast majority of cases, its not. But in the cases when people want to invent new globally useful abstractions, like bignum, promises, cleaner streams etc - i.e. to reshape the platform - they can't do that. For example, the overhead of adding bluebird as a dependency to every module quickly adds up, and bluebird had to fight with many issues stemming from multiple versions of it communicating with each other.

IMO while this has contributed to the growth of node the ecosystem, it also stifled the growth of node the platform.

Re:Temporary fork enables Node.js to optionally use the Chak... by efdee on Wednesday May 13, 2015 @05:11AM (#9537675)
No, it's a "bug". It is not required for loading specific versions -- those can be kept in a flat structure just as well. No need for the idiotic nesting.
Re:Temporary fork enables Node.js to optionally use the Chak... by bryanlarsen on Wednesday May 13, 2015 @08:24AM (#9538373)
IMO a flat structure would just be a confused mess. There would be hundreds of packages in that directory.
Re:Temporary fork enables Node.js to optionally use the Chak... by efdee on Saturday May 16, 2015 @11:44AM (#9556494)
I'd rather have hundred of packages in a well sorted flat directory than the same number of packages in an "Alice In Wonderland"-style rabbit hole.
Re:Temporary fork enables Node.js to optionally use the Chak... by espadrine on Wednesday May 13, 2015 @02:19AM (#9537119)
Having node_modules/[email protected]/ and node_modules/[email protected]/ would allow it as well. Yet each dependency would not keep a private copy of its own dependencies.
Re:Temporary fork enables Node.js to optionally use the Chak... by kuschku on Tuesday May 12, 2015 @07:16PM (#9535636)
Unless you create file paths that are so long that they break the default tools of the OS. That’s the point where you went too far.
Re:Temporary fork enables Node.js to optionally use the Chak... by pmontra on Wednesday May 13, 2015 @02:55AM (#9537249)
Or the OS went too short, so to say. There are two problems here.

1) Windows' limit of 260 characters per path name is incredibly small for a modern OS and that was true many years ago as well.

2) Npm approach relied on well behaved OSes and file systems allowing long path names. It's not future proof because you don't know on which OS and file system you'll need to run, maybe some limited embedded device.

Ruby's rvm solved that problem with a single directory level and a gem@version naming scheme.

Re:Temporary fork enables Node.js to optionally use the Chak... by kuschku on Friday May 15, 2015 @11:07AM (#9551097)
Exactly. Ruby’s solution will run even on FAT12 (which has only single-level directories), while npm isn’t really compatible.

In general, node does this quite often – their memory model also assumes they have infinite memory.

Re:Temporary fork enables Node.js to optionally use the Chak... by tracker1 on Tuesday May 12, 2015 @04:29PM (#9534630)
npm 3 will adjust dependencies to flatten these things out as much as possible, only creating nested dependencies when there's a version conflict between modules.
Re:Temporary fork enables Node.js to optionally use the Chak... by rational-future on Tuesday May 12, 2015 @03:25PM (#9534231)
With every new version of Windows, Explorer gets worse and worse. I personally switched to Directory Opus long time ago.
Re:Temporary fork enables Node.js to optionally use the Chak... by orik on Tuesday May 12, 2015 @03:36PM (#9534300)
This isn't a limitation of Explorer, but actually is a very well documented part of the Windows API. MAXPATH has always been 260 characters.

https://msdn.microsoft.com/en-us/library/aa365247(VS.85).asp...

Re:Temporary fork enables Node.js to optionally use the Chak... by frik on Tuesday May 12, 2015 @03:41PM (#9534334)
How long will Microsoft wait till the fix MAXPATH and other limitations? (and various other Win32 limitations that are usually a legacy porting helper thing from Win16). There would have been a good point with the introduction of Win64API - but Microsoft forgot about it and was apparently busy with something else.
Re:Temporary fork enables Node.js to optionally use the Chak... by CHY872 on Tuesday May 12, 2015 @04:36PM (#9534680)
I doubt it's too high up on the list of priorities. It would require really careful work to work in a backwards compatible way (there are almost certainly a tonne of apps that expect <=260 character filenames).

I guess the main thing is that it's one of those 'who cares' problems. The only time I've ever seen this limitation being complained about, it's by people who've had problems with npm.

That directory structure is undoubtedly horrible and is not mirrored by any other piece of software that I've seen.

Re:Temporary fork enables Node.js to optionally use the Chak... by jessaustin on Tuesday May 12, 2015 @06:26PM (#9535405)
Meanwhile it's also a "who cares?" problem for the npm people. They don't use this OS, and don't expect ever to do so.

I think the node_modules directory structure is a novel, though straightforward, solution to the problem of interdependent module versioning. It's very Unix; it reminds me a bit of GNU stow. It makes perfect sense that it will be tweaked in the new npm to be less redundant, but it only really makes sense to tweak systems that already work perfectly. (Otherwise they should be fixed first, then tweaked.) Certainly it's better than having a separate LD_LIBRARY_PATH setting for every command invocation! (even that doesn't fix everything...)

Re:Temporary fork enables Node.js to optionally use the Chak... by xienze on Tuesday May 12, 2015 @07:11PM (#9535615)
It doesn't even seem like an obvious solution to the problem. Take Maven for instance: a global dependency repository under which the dependencies are stored in the form <groupId>/<artifactId>/<version>. If X depends on Y.1 and Z depends on Y.2, so what? You have all the dependencies stored on your filesystem in a relatively flat structure.
Re:Temporary fork enables Node.js to optionally use the Chak... by jessaustin on Tuesday May 12, 2015 @09:23PM (#9536153)
If I had coded in Java on Windows for years, I wouldn't trust my sense of what's "obvious". I'm not too impressed by a "global" repository either. Python struggled against that stupid architecture for years before they got virtualenv in good working order. Node just took a shortcut to the future.

"All direct dependencies are in the node_modules directory, full-stop" is a pretty simple rule. Really, that's the only rule, and that's all of it. You don't need to worry about second-order dependencies, because those are direct dependencies of some other module, which means... they are in that module's node_modules directory.

Re:Temporary fork enables Node.js to optionally use the Chak... by ygra on Wednesday May 13, 2015 @02:34AM (#9537172)
I had the problems with a Java codebase in SVN (back when your user profile was still under C:\Dokumente und Einstellungen\Username\...

Apart from that there is a backwards-compatible way of using longer paths, which is prefixing with \\?\. Since MAX_PATH is a hard-coded constant there can only be an opt-in way of dealing with the problem. Sadly many application or framework developers these days still don't opt in.

It also creates the problem that if Application A can create such paths and Application B cannot read them, you'll be annoyed too. And Application A might just disable long path support to mitigate the problem, leaving the whole state as it is.

Re:Temporary fork enables Node.js to optionally use the Chak... by dspillett on Wednesday May 13, 2015 @04:45AM (#9537589)
> The only time I've ever seen this limitation being complained about, it's by people who've had problems with npm.

Recently that is where you'll have heard about it a lot, but people have been hitting the problem for years. I've hit it in a couple of distinct contexts in my time.

You hardly hear about it generally because people moan a bit then work around it so the problem goes away until next time, and sometimes people don't even moan about it because it is such an old problem they just think "oh, that again, better make my directory/file names and/or paths a bit shorter" and get on with their day.

The difference between this and with npm over recent times (causing the greater noise around the issue) is that twofold:

* linux/similar people hitting the problem in the wild for the first time (they've probably heard about it, but never had to deal with it) because their code is getting used on Windows which was much more a rare occurrence for them in the past, and being incredulous that such a problem exists in this decade

* Windows people wanting to use node and similar cool new tech on their preferred and/or mandated platform but hitting issues due to this problem in their environment (and in some cases being incredulous that someone wouldn't consider the implications of the limitation it in their design)

Re:Temporary fork enables Node.js to optionally use the Chak... by noinsight on Wednesday May 13, 2015 @04:47AM (#9537592)
> I guess the main thing is that it's one of those 'who cares' problems. The only time I've ever seen this limitation being complained about, it's by people who've had problems with npm.

If you work on the sysadmin side of things, this comes up almost every time with directories on network shares. Explorer, cmd and PowerShell can't handle them and you need to resort to using robocopy or 3rd party tools like FastCopy. To delete stuff you often have to resort to hacks like robocopy mirroring an empty directory into the path before deleting it.

Re:Temporary fork enables Node.js to optionally use the Chak... by efdee on Wednesday May 13, 2015 @05:15AM (#9537686)
It is a limitation of Explorer and CMD.EXE - Windows has had Unicode APIs to access paths up to 32767 characters, but for some reason they have Explorer and CMD.EXE use the older ANSI API which does not support it.
Re:Temporary fork enables Node.js to optionally use the Chak... by chimeracoder on Tuesday May 12, 2015 @03:31PM (#9534275)
> With every new version of Windows, Explorer gets worse and worse.

This criticism is a bit misplaced here, since the whole reason for this limitation is due to backward compatibility with older versions of Windows (and software written for older versions).

It's not like this is a new change in Windows; it's been there for ages.