TIL: How to publish an npm package


I’ve been trying to learn Effect-TS by working on a little http-client for the spotify api. It ain’t much yet, but one of the goals in this project was learning how to publish an npm package.

Quite happy with the workflow so far.

Now, onto how it’s done. These are the main tools I used:


This tool does a lot of the publishing heavylifting.

  • Maintaining the changelog
  • Publishing to npm after merging into main and providing a changeset
  • Coupled with github actions to automate the process

Permissions (npm & repo)

  • You need to create a token on npmjs.org
  • Add that token to your repo’s environment variables. Mine’s named NPM_TOKEN
  • Add the changeset bot to your repo
  • Navigate to Repo settings > Actions > General > Workflow permissions and allow read and write permissions, and also allow github actions to create and approve pull requests

Challenges I faced

I had the release workflow running, but it wasn’t publishing the package to npm.

Running changeset publish was givinig me the following output

🦋  warn No unpublished projects to publish

Ultimately, I made these changes and things resolved themselves:


- "private": "false",
+   "publishConfig": {
+    "access": "public"
+  },


-  "access": "restricted",
+  "access": "public",

Learning Resources