Skip to content

Using npm publish publishes only part of the files #26808

Using `npm publish` publishes only part of the files #26808
Jul 15, 2021 · 6 answers

In one of my repositories I’ve started publishing the files using gha.
In the same repo, when doing npm publish, the package would have publish as expected.
When I’m using the same command in the repository, only some of the files are being published.
In my package.json I’ve set npm to publish two folders:

  "files": [
    "dist/**/*",
    "template/**/*"
  ],

Here are images from the repository’s relevant action:


You can see that the template folder exists but only a few files are packaged. The template folder has many more files and folders.

What can be the problem here? Is there anything different when publishing from gha?

Thanks!

Found the issue - it was the npm version.
gha has version 6.x, while locally I’ve been using 7.x.

Replies

6 suggested answers

When using ls, I can see the files are already there:
image

0 replies

When I publish locally (on my machine) the publish works as expected:

0 replies

Found the issue - it was the npm version.
gha has version 6.x, while locally I’ve been using 7.x.

0 replies
Answer selected

Thanks for the update @YonatanKra.
Did you figure out what was the actual issue for which npm6 didn’t publish as you expected?

0 replies

Yes. I had a package.json file in one of my templates. It was taken as a “real” package.json file and interfered with the actual deployment to npm.
Note to self - if you add tmpl suffix to html and js files - do the same for json files cause you can never know :slight_smile:

0 replies

Ahh gotcha! Glad you caught up to that nasty one :slight_smile:

0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants