Unable to publish npm package to github packages when upgrading from node 14 to node 16

101 views Asked by At

We are trying to publish a library after upgrading it from angular 12 to angular 14. As part of this upgrade we are also upgrading to node 16.20.2.

The repo path of the library is : https://github.com/[private namespace]/platform-ui-components.

When we build the angular library, we generate artifacts in "dist/ngx-components".

The package.json of the library hasn't changed much, and here are the critical properties that I am aware of is needed:

{
  ....
  "repository": {
    "url": "[email protected]:[PRIVATE NAMESPACE]/platform-ui-components.git"
  },
  "publishConfig": {
    "registry":"https://npm.pkg.github.com/"
  }
}

This used to work fine on publish with older angular and node version. When we try to publish it now, we get following exception the logs:

error command git --no-replace-objects ls-remote ssh://[email protected]/dist/ngx-components.git

It seems like its setting up the dist path that we want to publish as the repo, instead I would think this value should be ssh://[email protected]:[PRIVATE NAMESPACE]/platform-ui-components.git

I am not sure if the upgrade requires some parameter change that I am unaware of but any help to resolve this would be appreciated.

1

There are 1 answers

0
Deewendra Shrestha On

I am able to publish the library now. Instead of running

npm publish dist/ngx-components

I followed the exact instruction from https://angular.io/guide/creating-libraries#publishing-your-library and that did the trick.

Basically I changed the working directory to the distribution folder for the library and then ran npm install. So basically:

cd dist/ngx-components
npm install