Forum Discussion
"The package.json file is too large. Size limit is 384000 bytes" when trying to push npm package to
Duplicate from https://learn.microsoft.com/en-us/answers/questions/1350857/the-package-json-file-is-too-large-size-limit-is-3 site, but I got no help there and also was redirected on https://twitter.com/AzureDevOps/status/1696141419906273395 to post there, so sorry for the spam.
We are migrating to Azure artifacts from our locally hosted nexus.
We have one npm lib, which has a quite big package.json, and also a couple of bigger files (>1MB).
Is it somehow possible to push that to Azure, and then use it as a normal npm package in our projects?
If not - why is there such a limitation? I could not find anywhere anything regarding package.json/single file limitation, the only I found was for the whole package or even for the whole file, mentioned there https://learn.microsoft.com/en-us/azure/devops/artifacts/reference/limits?view=azure-devops#size-limits
Npm packages: limited to 500 MB per file.
whereas our lib, packed (tgz - normal npm packaging) has 8.4 MB, unpacked ~44, the biggest file had 1.8MB, and package.json had 1MB. Even after removing that huge file, leaving files only below 1MB and cutting that package.json below 340KB, we still had an error which was saying that I could not push files above 1MB. Even pushing just package.json caused the same error - cannot push files heavier than 1MB (it had 340KB).
2 Replies
- Witold_KupsCopper Contributor
Kidd_Ip
If I would like to, I could find some solution.
But I do not want - Microsoft requires us to pay for the repository.
Why then I should narrow something what I have for free with nexus?
Not to mention it is just Microsoft's requirement, without any reasoning behind? Take this:
Trim package.json
- Move large config blocks (e.g. scripts, metadata, custom fields) into separate .json files.
- Use require() or import them in your code instead of embedding them in package.json.
Split Large Files
- Refactor large modules into smaller ones.
- Consider lazy-loading or dynamic imports if applicable.
Use Universal Packages
Azure Artifacts supports Universal Packages, which allow:
- Up to 4TB per file
- Ideal for binaries, large assets, or even bundled npm-like content
You won’t get native npm install support, but you can script downloads and unpacking.