Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Centralised node_modules folder #2067

Closed
alshdavid opened this issue Nov 29, 2016 · 4 comments
Closed

Feature Request: Centralised node_modules folder #2067

alshdavid opened this issue Nov 29, 2016 · 4 comments

Comments

@alshdavid
Copy link

Is there a way to install all npm dependencies globally (centrally) so that you do not store node_modules in the project folder?

This is causing problems as the framework the company I work for uses is quite heavy and I have over 40 projects each with their own node_modules folder, packed with millions of 1kb files.

This takes up a surprising amount of precious space on my SSD and it would be really nice if I could just install these packages once, with any project's package.json linking to my local repository

@ljharb
Copy link

ljharb commented Nov 29, 2016

@alshdavid things that you require are dependencies, and need to be installed locally. global modules are for non-project-specific command line tools.

imo this isn't really a yarn question unless yarn provides a way to symlink global modules into the local directory, which I'm led to understand wouldn't work with the npm ecosystem.

@Daniel15
Copy link
Member

I think this would be useful. The issue is that it's hard to change how things are done without changing Node.js, as Node.js expects things to be done a particular way and modules to be arranged in a particular way. 😞 I'd also love to rename the directory from node_modules to something else as not everyone uses Node.js.

There's a few GitHub issues around symlinks and hardlinks as a potential solution for performance and disk space - #499 covers hardlinks. The files would still take up some space in the file system though. I feel like a Copy-on-Write filesystem such as BTRFS or ZFS would help with this too, as the files won't actually be copied and would instead just point to the original files in the cache directory.

@vjpr
Copy link

vjpr commented Dec 5, 2016

https://github.com/rstacruz/pnpm does exactly this. Uses --preserve-symlinks Node feature.

@BYK
Copy link
Member

BYK commented Oct 27, 2017

The closest to this seems like #499 so I'm closing this one in favor of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants