Live data from Hacker News

Node's nested node_modules approach is basically incompatible with Windows

github.com

41–50 of 62 posts

Re: Node's nested node_modules approach is basically incompatible with Windows

#41
post #22

Know the biggest issue I've had with Node (well not me, but my colleagues)? That modules have a habit of using symlinks, which break horridly across Vagrant/VirtualBox shared folders. We ended up fixing it somewhat by using the --no-bin-links option on `npm install` and swapping over to SSHFS, but I really wish module writers would pay more attention to Windows... one of Node's strengths is that it works pretty darne…

Again, this is a Windows issue with its horribly broken symlink handling.

Re: Node's nested node_modules approach is basically incompatible with Windows

#42
post #14

Earlier quoted context omitted.

At first I agreed with you; but then I read one of the comments on github that swayed me. "You are the one playing games - calling core parts of Windows like Explorer "3rd party tools", and suggesting that not supporting long paths is a bug. Microsoft have made it clear repeatedly that non-support for long paths is not a bug, and not something that will change. A package manager creating paths that do not work with t…

Microsoft can decide to not call it a bug but that doesn't mean the rest of us don't believe it's a bug.

In that case Node.js has a huge bug - only natively supporting one messy legacy language (without crap-transpilation).

Re: Node's nested node_modules approach is basically incompatible with Windows

#44
post #22

Know the biggest issue I've had with Node (well not me, but my colleagues)? That modules have a habit of using symlinks, which break horridly across Vagrant/VirtualBox shared folders. We ended up fixing it somewhat by using the --no-bin-links option on `npm install` and swapping over to SSHFS, but I really wish module writers would pay more attention to Windows... one of Node's strengths is that it works pretty darne…

Again, this is a Windows issue with its horribly broken symlink handling.

So, let's go fix it.

Sorry, but complaining about the base platform behavior doesn't help much if you want to build software on it.

Re: Node's nested node_modules approach is basically incompatible with Windows

#45
post #8

This definitely seems more like a Windows issue than a Node issue.

Is creating dozens of nested folders inside each other really a sane thing to do? Run `find .` on any reasonably complicated node project and look at the crazy paths that show up. npm's strategy of nesting like that made things simpler when it was more of a new project, but it's time to come up with something more robust.

This; each subproject having its own nested string of (often the same) dependencies just seems wasteful of me.

I like Maven's approach better; a centralized repository directory. In Node / NPM's case, given that each library has a simple name, I can imagine a directory structure ~/.node_modules/package/1.0.0. Severely reduces filesystem depth, and probably fixes re-downloads of the same package / versions too. Only requirements are a rewrite or update of node's require method, NPM's package install directory and maybe some more strictness about NPM releases.

Re: Node's nested node_modules approach is basically incompatible with Windows

#46
post #12

The easiest solution I've found is to just run a VM and not sync whatever folder you install node_modules in. I just had this problem like a week ago with gulp because I was syncing the folder I was building in. It's a good time to learn how to use Vagrant.

There are people using node as part of their desktop software for scripting. Atom for example. Vagrant that.

Re: Node's nested node_modules approach is basically incompatible with Windows

#47
post #8

This definitely seems more like a Windows issue than a Node issue.

Is creating dozens of nested folders inside each other really a sane thing to do? Run `find .` on any reasonably complicated node project and look at the crazy paths that show up. npm's strategy of nesting like that made things simpler when it was more of a new project, but it's time to come up with something more robust.

I disagree. I think node's approach is easily understandable, and quite robust. It's incredibly easy to dive down the dependency chain and see every package, and know exactly which one is being used where. Not something that can be said about package managers that use the flattened approach.

Re: Node's nested node_modules approach is basically incompatible with Windows

#48

The title looks exaggerated. I thought NodeJS cannot just run on Windows anymore. It's not the case though, it does - it's just it creates folders that are nested.

Totally. This is actually a trivially solvable problem (I've been working on a meta package manager compatible with npm, bower and component). The strategy I took with node_modules/, components/ and bower_modules/ was to just follow whatever folder structure it found as far as necessary and look for manifest files (package.json, bower.json and component.json) and register modules at the path of wherever one of those…

I respect where you're coming from, but I disagree. One of the huge advantages of npm for me is that it's so transparent and I can see exactly how it's mapping to the file system. I know exactly which code is being run, from where—because it's incredibly easy to traverse the dependency tree. If you abstract away the fs level and flatten the dependencies into a single folder, you take this away, and you make the dependency tree essentially a big intimidating blob of code that requires slogging through package lists to determine what is actually being used.

Re: Node's nested node_modules approach is basically incompatible with Windows

#49
post #22

Know the biggest issue I've had with Node (well not me, but my colleagues)? That modules have a habit of using symlinks, which break horridly across Vagrant/VirtualBox shared folders. We ended up fixing it somewhat by using the --no-bin-links option on `npm install` and swapping over to SSHFS, but I really wish module writers would pay more attention to Windows... one of Node's strengths is that it works pretty darne…

If you're using OS X or Linux, you can create a `node_modules` symlink in the shared folder to a local guest directory.

IIRC, for OS X, you must create the link from the host. It works because `ln` doesn't check whether the destination of the link exists. So running

    ln -s /home/vagrant/node_modules node_modules
in the shared folder from the host will create a link that is functional in the guest.

No idea for Linux hosts.

Re: Node's nested node_modules approach is basically incompatible with Windows

#50
I ran into this yesterday, having tried to install yeoman into a folder shared between a windows host and a linux vm. Ended up with files which could not be deleted by any other way than from the windows command prompt using the 8.3 filenames.

An hour of swearing was enough to convince me to stop using windows for this entirely.

Post reply on HN