Hello, Claudio! All right?
Then, every time we use npm or Yarn, a file called Package.json is created, there is written all the data pertaining to your application, such as author name, license type and mainly all npm dependencies that the project uses.
example:
{
"name": "servidor",
"version": "1.0.0",
"description": "Livraria Casa do Codigo",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon src/app/server.js"
},
"author": "Vitor Cordeiro",
"license": "ISC",
"dependencies": {
"express": "4.16.3",
"marko": "4.13.4-1"
},
"devDependencies": {
"exact": "^0.8.0",
"nodemon": "^1.18.4"
}
}
in "dependencies" are all the dependencies of your project. And in "devDependencies" are the development dependencies, those that are needed only in development and production mode are removed from the project.
And if I erase any dependency??
When this happens, a tip: Relax! hahahahaha
Even when development teams are working together and need to share the project with others, they only send folders that contain code and logic, and the Package.json file.
The node_modules file is not sent together to decrease the size of the uploaded file.
The person who picked up the files type only 1 command in the terminal
npm install
with this command npm will "read" the contents of the Package.json file and see all the dependencies that the project contains and will install them automatically.
I hope you answered your question!
until the next!
If I remove the dependency, this can happen: https://www.theregister.co.uk/2016/03/23/npm_left_pad_chaos/
– hkotsubo
@hkotsubo I was remembering this.
– Augusto Vasques