Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Package file size limit #12750

Closed
christianesperar opened this issue May 18, 2016 · 10 comments
Closed

Package file size limit #12750

christianesperar opened this issue May 18, 2016 · 10 comments

Comments

@christianesperar
Copy link

Is there any limit on how big the package is? I tried to publish package with a size of 10+ mb and failing.

@othiym23
Copy link
Contributor

There's not a hard limit, but since the whole package tarball is serialized into a single Base64-encoded string before being sent to the registry, there's an effective limit that depends on the memory available to the CLI process. Also, it can take a long time to send to the registry, which for some publishers and some registries, including the primary registry, can lead to timeouts.

If you're encountering timeouts and not crashes due to memory exhaustion, @npm/registry-team is working on bumping up the timeouts across our registry architecture. You may want to take this question to npm/registry if you want support from that team.

If you're encountering out of memory errors, you might want to use a beefier host to publish. 10MiB package tarballs shouldn't need more than ~100MiB free RAM for publishing (building big strings in memory is not super economical with V8), so unless you're publishing from a small droplet or a RasPi you should be fine.

Speaking prescriptively for a moment, a 10MiB package is big, but not unreasonably so. 20MiB is starting to push it. Practically speaking, much larger than about ~120MiB just isn't going to work for either clients or back end services, and should be avoided / broken down into smaller packages.

We'd very much like to convert the internals of npm to be streaming whenever possible to get around this, but the current size caps are known, so this is somewhere between a design limitation / bug and a feature request to address, and there's no particular timeframe in which the CLI team might get to it. I'll leave it you you to decide when to resolve this issue. Good luck!

@christianesperar
Copy link
Author

It seems that it's failing because of unstable internet connection. When I tried it on our office it works like a charm!

@shoerob
Copy link

shoerob commented Dec 15, 2016

With Cordova now utilizing npm for the publishing of plugins, there is the possibility of packages easily exceeding 20MB. I'm currently writing a plugin that contains a couple iOS static libraries to add support for interopping with some native 3rd party SDKs. Currently the size of my plugin is 37MB, primarily due to the static libraries. Going forward, as I add support for other platforms such as Android, I can foresee this package easily hitting the 100MB mark. I've hit the size limit before (accidentally), so I'm worried about hitting it again as my plugin increases in size. That being said, in this context, over 20MB doesn't seem unreasonable. However, do you think that large Cordova plugins would be better off residing in a GitHub repository rather than being published to a package provider via npm?

@stanleyxu2005
Copy link

Due to the limitation of base65 encoded string, I cannot publish a 300mb prebuilt packages in private repo. I do hope we can remove this limit or I have to seek for another deployment tool.

@xaviergmail
Copy link

@stanleyxu2005 I'm facing the same dilemma. Have you figured out an alternative?

@stanleyxu2005
Copy link

@xaviergmail Well, I gave up the idea of publishing huge package.

@mukteshkrmishra
Copy link

I am also facing the same issue. Looks like this is going to be a pain.

@xaviergmail
Copy link

xaviergmail commented Oct 11, 2017

Since I run a private registry using Verdaccio, I decided to just scp the tarball over. It's a disgusting hack, but it downloads fine afterwards!

@piraji1
Copy link

piraji1 commented Oct 19, 2017

hello.
to xaviergmail.
I am also facing the same issue tool. would you introduce a solution using scp command?
regard..

@vladholubiev
Copy link

What helped me to publish a ~90 MB package :

  1. Upgrade to node 10
  2. Add --max_old_space_size=10336 inside ~/.yarn/bin/yarn

And it took 4.5 minutes

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

No branches or pull requests

8 participants