Skip to content

Unable to publish manually packaged NPM archives with custom root folder name

Summary

We see that after our change to upload NPM packages async some customers are reporting Error publishing · package.json not found errors. This happens if they publish manually packaged archives. I can replicate the issue, example project. This happens if archive with the bundle has root folder with custom name, like so.

We are expecting that folder to be named package (source).

@10io researched whether there is any spec around the tgz structure but couldn't find one.

It seems that npm install will consider these as a package: a) a folder containing a program described by a package.json file b) a gzipped tarball containing (a) So, all that is expected is that a folder has a package.json file.

$ npm pack seems to be using package for the folder name but in reality $ npm install only requires a single folder. See. It might be for compatibility reasons. If $ npm install has no problem with folder names other than package then I think we shouldn't expect package/package.json but */package.json.

Steps to reproduce

  1. Fork this project and run npm jobs to publish archives.

What is the current bug behavior?

Uploading the package fails with Error publishing · package.json not found errors

What is the expected correct behavior?

Package uploading shouldn't fail.

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com

Possible fixes