M
M
Michail2021-08-09 15:22:05
npm
Michail, 2021-08-09 15:22:05

How does package-lock work?

npm i automatically generates a package-lock and specifies the versions from the manifest.
Let's say we have rxjs ~ 6.6.0 in package.json in package-lock, it will fix version 6.6.7.
But here comes 6.6.8. We make npm i version the same.
We remove the lock and rxjs from node_modules, do npm i, the version has become 6.6.8.
Is that how it should be? I thought that lock is updated with every npm i. It turns out that 6.6.7 fits under ~6.6.0 and is not updated, although a new version has already been released that should have a new hash, how does this comparison mechanism work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2021-08-09
@Lynn

npm install tries to keep the versions that are in package-lock.json if they do not conflict with package.json.
To update there is a command npm update

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question