What is npm shrinkwrap and when should it be used?
- What is Java? Why choose Java?
- What is WebAssembly?
- 9 reasons you should equip a little knowledge of HTML and CSS
The npm shrinkwrap command allows you to lock all versions of packages and descendants of children and grandchildren in the node_modules directory. This article will explain why and when to use the npm shrinkwrap command during your application development.
The package manager npm works quite well in maintaining and installing dependencies for all packages that your project requires. It does that by installing a package hierarchy in the node_modules directory.
There are two main problems with how to set up npm activity:
1. Although npm encourages the use of semver to manage the application version of packages, it depends entirely on the package author's compliance with this principle. This may be a problem if a package in your application does not follow semver, a new version of this package may cause an error.
Even, even if the author of the package follows semver, the error can still occur in a introduced version that is compatible .
2. Another problem arises because of how to set up npm activity . When running an npm setup install a package hierarchy, if you want to correctly install the package version number, you can use the exact version number of the packages in the package.json file. However, that only solves the problem for direct dependencies without helping you control the version of the package packages in the package and more.
This can be very important to you in a production environment because you need to make sure that every time you deploy the product, you always install the same version of the package as other implementations.
This is the time you need to use npm shrinkwrap . When you run the npm shrinkwrap command in a project after running the npm install command, it creates a file called npm-shrinkwrap.json , which lists exactly the version of all packages installed in whole package hierarchy. If you move to a version management system when your colleague clone the source code and run the npm install command, it will correctly install the package version in the entire hierarchy, as specified. in the file npm-shrinkwrap.json .
To update the npm-shrinkwrap.json file, you will need to run npm update, then determine the exact package you need to run the npm shrinkwrap command to update the fle npm-shrinkwrap.json.
If you need to find outdated (outdated) packages, just run:
npm outdated
The above command will notify you of obsolete packages. You can check them and decide whether or not to include them in the product after a thorough inspection.
Also, note that npm shrinkwrap does not include devDependencies unless you run with the -dev flag:
npm shrinkwrap --dev
Refer to some more articles:
- Form a way of thinking like a programmer
- 11 basic principles that every programmer should follow
- Journey from unknown to becoming software engineer in San Francisco for 12 months
Having fun!
You should read it
- In the end, big universities realized that Java was a lousy language if used for introductory programming
- These programming languages for the best mobile application development
- Why should you learn Python programming language?
- The reason why C programming language is never outdated
- Test on C programming P6
- What is the first programming language in the world?
- What do you know about Smalltalk programming language?
- 10 programming languages booming today
May be interested
- Check out the 'buffalo' Pokémon in Pokémon Goeach type of pokemon has hp, cp, ability to attack and endure differently. based on these indicators, players can determine as well as choosing the most powerful pokemon for their offensive tactics.
- Sitting home can also locate Pokemon around, do you believe it?the tightening of the niantic developers' rules to prevent players from abusing the support tools also brings annoyance, such as those who have no conditions to move much, go away, it is hard to know. get the location of the pokemon around the area they live in
- 5 undeniable benefits when playing Pokemon Goget to know many new people, breathe fresh air, relieve stress, increase concentration thanks to going out for a walk .... are compelling reasons to force you to try pokemon go now .
- Want to earn the fastest Pokécoins in Pokémon Go? So don't miss this article!pokécoins in pokémon go play the role of buying items in the store. the more coins you earn, the more likely you are to buy more items. to earn pokécoins, players will have to complete certain tasks or buy real money.
- Pokémon systems when fighting in Pokémon Goeach pokémon system in pokémon go has different strengths, along with a specific weakness. this type of pokémon will have the power to attack the other pokémon, but can defeat the other pokémon. if you know the characteristics of each type, it will be easier to choose which pokémon to battle.
- The terms you need to know when playing Pokémon Gopokémon go is the most prominent name in recent days. this game of capturing and training virtual animals has created a relatively new way of playing, as players have to constantly move to catch pokémon. during the process of joining pokémon go, you will encounter and use a lot of important terms. so what do they mean?
- How to play Pokemon GO on Windows computersrecently, pokemon go has become a popular game, attracting thousands of gamers around the world. in previous posts network administrator has guided you on how to play pokemon go on android devices and ios devices. in the article below, network administrator will guide you how to play pokemon go on windows computers using bluestacks emulator software.
- How to become a good Pokémon Go hunter?with a new way of playing, pokémon go has created a new phenomenon in the game village around the world. players will have to go around and find pokémon for themselves. so how to quickly catch pokémon and in large numbers?
- Things to know to upgrade Pokémon in Pokémon Gothe whirlwind pokémon go has spread its power right on the first day of its release. everyone rushed to the street to find a pokémon for themselves. therefore, in order to become a pokémon hunter, you need to master the basics of participating in pokémon go battlefield.
- List of medals received in Pokemon Goin addition to getting items when leveling up, gamers who join pokemon go also have the opportunity to receive their proud achievements.