Understanding How to Manage Node_module in npm

Asked 1 years ago, Updated 1 years ago, 92 views

When installing node_module in npm 5.6.0, the default is to start the library version in package.json with ^.I understand the meaning of ^, but if I share package-lock.json with developers, will the meaning of ^ disappear?Also, is there any difference from deleting the description of ^ from package.json without sharing the lock file?

Example

"clean-css": "^4.1.9",

npm

2022-09-30 21:29

1 Answers

I understand that you are developing an app because it is package-lock.json.

In package.json, the restrictions on the library version to be used are described. The package-lock.json describes the version of the library that was actually installed based on the constraints of package.json.

If you are developing an application, you may be able to release a newer library than you did during the initial library installation.Therefore, in such cases, you will have to run npm update to update the utilization library. https://docs.npmjs.com/cli/update.html

Basically, it's better to use the latest library in the app, but if it's too new, it might run into breaking change and break the app.

So, basically, package.json has constraints such as "at least this version or higher, but there is no major version upgrade, so I want to install it in a good way." is a constraint statement that specifically enables it.

This allows you to "update the utilization library in a good way and update the package-lock.json" at npm update above.


2022-09-30 21:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.