NPM5 Packag-lock.json

Source: Internet
Author: User

A few days ago, after upgrading the node. JS v8.0, the self-brought NPM also upgraded to 5.0, the first time the use of the time is really amazing: the original re-installed module to more than 10 seconds to things, now more than a second to take care of. Don't get excited, now I'm going to talk about some big changes in NPM 5:

    • When using the npm install xxx command to install the module, the option is no longer required --save and the module dependency information is automatically saved to the Package.json file;
    • Installing the module action (changing the contents of the Node_modules folder) generates or updates the Package-lock.json file
    • The published module will not contain the Package-lock.json file
    • If you manually modify the version of a module that is already in the Package.json file, direct execution npm install does not install the newly specified version, only by npm install [email protected] updating

Reinstalling the module is fast because the Package-lock.json file has been recorded in the entire Node_modules folder tree structure, even the module is recorded, and then re-install only need to download files directly (so it seems that Facebook's Yarn doesn't seem to have much advantage.)

With speed, npm dug a big hole:

in the future, directly change the version number of the corresponding module Package.json file, and then execute npm install will not be updated (scary), you can only manually npm install [email protected] install with the specified version number, and it will automatically update the Package-lock.json file. When executed directly npm install , if the Package-lock.json file does not exist, it is created according to the Node_modules directory structure after the module is installed, and if the Package-lock.json file already exists, it will only be based on the The Package-lock.json file specifies the structure to download the module and does not ignore the Package.json file.

Article:Understanding Lock Files in NPM 5 Link: http://jpospisil.com/2017/06/02/understanding-lock-files-in-npm-5.html

Here is the NPM documentation for instructions on package-locks Link: https://docs.npmjs.com/files/package-locks

NPM5 Packag-lock.json

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.