S
S
Sergey Melodin2020-03-19 14:22:48
JavaScript
Sergey Melodin, 2020-03-19 14:22:48

How to fix npm ci ignoring registry specified in package-lock.json?

I published the npm library in the corporate registry, installed it in the project with the command npm i @my/package --registry http://corporate.npm, it was installed as a dependency, and the corresponding entry appeared in the lock file:

"@my/package": {
  "version": "6.6.6",
  "resolved": "http://corporate.npm"
  ...


Now it turned out that when executing the npm ci command, this dependency is looked for in the npmjs.org registry instead of the corporate one. Actually the question is: why and how to fix it?

----

For ci /cd, I stuck a fix with the command npm config set registry, but it turns out that it:
a) is not intuitive, because we work through more than one registry, after all
b) requires the execution of this command on each developer machine, which is inconvenient

Of course, everything is wrapped in a container, even local development, and you can get out by explicitly setting the registry in the image. But I would like to understand why npm ci does not look at the registry from the lock file and whether it can be forced.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Prilepa, 2020-03-19
@melodyn

As far as I understand, it is necessary that the .npmrc file be in the project and it should contain a line like:
@my/package:registry=http://corporate.npm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question