lerna-update-wizard icon indicating copy to clipboard operation
lerna-update-wizard copied to clipboard

Not working with private repos

Open furstenheim opened this issue 6 years ago • 5 comments

Hi Nice cli. I've tried updating a private npm package (by that I don't mean "private": true but rather that it is published to npm as a private library) but I get the following error:

An error occurred: Error: Could not look up "my-private-package" in NPM registry

npm token is correctly set up, as I can publish using lerna.

furstenheim avatar Feb 28 '19 07:02 furstenheim

Hi!

I must admit that I have not had this use-case in mind. The problem comes from the npm info call that the script does to look up the package and its versions: https://github.com/Anifacted/lerna-update-wizard/blob/master/src/index.js#L209

Too bad that NPM does not seem to allow this, even when your token is correctly set up.

Can you please confirm that npm info @my-private/package gives you an error when running it on your machine (with the correct package name of course).

Fixing this problem would require some logic for bypassing the look-up stage for scoped, private packages, but that would mean that we do not have the list of versions to install from, and the rest of the script would have to be adjusted for that.

Anifacted avatar Feb 28 '19 08:02 Anifacted

Can it be that the problem is in the npm client? I don't have npm correctly set up (faulty installation). I use yarn, which does work with yarn info @my-private/package and which is configure in lerna.json as "npmClient": "yarn"

furstenheim avatar Feb 28 '19 08:02 furstenheim

Can it be that the problem is in the npm client?

Could be. I would suggest you try and get a healthy installation of NPM on your system, if possible. This would probably be a good thing for your setup in general :)

lernaupdate simply allows for using Yarn as the installer, since you may be using it for managing your dependencies, but it still depends on NPM internally for this lookup.

I suppose I could add a change to conditionally use Yarn for this lookup instead, but as far as I remember, older versions of Yarn returned a different output that NPM when using the info command, and that is why I stuck with NPM, (to avoid extra code complexity).

Anifacted avatar Feb 28 '19 09:02 Anifacted

Just ran into the same issue, seems that the registry config in my package's .npmrc is not honored by the npm info call that is made during lernaupdate.

The workaround I found was to provide my private registry config as an environment variable. NPM_CONFIG_REGISTRY=https://my.privateregistry.org lernaupdate --non-interactive --dependency @private-scope/foo-package

jasonmobley avatar Nov 12 '19 15:11 jasonmobley

Same issue, using Yarn and .npmrc as my usual private registry configuration file.

Solved in my case by adding .yarnrc to root with contents:

registry "https://example.com"

willingram avatar May 21 '20 15:05 willingram