Does using ember-cli always have to install 177MB node_modules on every project?

I just started trying ember. When generating a new app using ember-cli new my-app, it takes about a minute. And it creates a 177MB node_modules directory in my project.

177MB for a blank new project? That seems too much. Can the node_modules be installed globally? So at least creating new ember project doesn’t take 1 minute on broadband connection (or 20 minutes on slower connection). And so I can use my limited disk space for other things.

1 Like

Not for project dependencies, no :/. I wish npm stored versioned dependencies in one location, but alas it doesn’t. I’m not sure why node decided to go the route it did.

You could hack this if you wanted to by using a shared node_modules directory and sym-linking it into each of your projects manually. It might create some interesting issues, but at least you’d be able to figure out if it was good enough for you rather quickly.

1 Like

Thanks! I guess using symlink is a pretty good workaround. I see that I can use the --skip-npm option when generating new project.

If you are worried about bandwidth usage, npm by default caches packages. After deleting npm root cache and node_modules/, ember install pulls only about 30 mb of data from internet.

But, after uncompressing, it take 180+ MB of disk space.

You can clone the module ember-cli and run npm link inside the folder. Then run npm link ember-cli in the project folder.

What do you mean by “clone the module ember-cli”? do you mean copy -r my-project/node_modules/ember-cli /your/global/node_modules ?

I see there is already an ember-cli module in my /usr/local/lib/node_modules which is almost exactly the same as the one in the project dir, with a bunch of minor difference like this

$ diff -r /usr/local/lib/node_modules/ember-cli my-project/node_modules/ember-cli 
...
<   "_resolved": "https://registry.npmjs.org/yam/-/yam-0.0.18.tgz"
---
>   "_resolved": "https://registry.npmjs.org/yam/-/yam-0.0.18.tgz",
>   "readme": "ERROR: No README data found!"
...

I mean after install global package, run npm link ember-cli in the project folder.

Hi, It is also the part I don’t like with ember cli. It’s look like if we have to install gimp each time we create a new jpg and keep the soft with the file all the time. (Easy to say but) isn’t there any plan to make ember cli look more like a “software” in the future ? one installation and may be a graphic interface to install / remove addon, update them… with very light project folder ?

ember-cli is in the process of adopting yarn, so the initialization of a new project should be faster soon (if you use yarn).

RFC: https://github.com/ember-cli/rfcs/pull/88

It looks like it’s going to be fine !

Thanks