14
What difference when installing a module via NPM, use --save?
When using npm install product name, it installs the same and save the modules to the project folder.
I didn’t understand then when to use npm install product name --save
Someone to help me?
What would define them one by one?
– Luhhh
have to give
npm install fs
,npm install bower
one by one on all machines where the project is downloaded. After you do the first installation, if you need to install on the server for example you only give onenpm install
purely– Sorack
I’m not currently using package.json, which can be a bad thing with this?
– Luhhh
If I do not miss the memory will just not write to the file, then it would be the msm thing that a
npm install xxx
normal– Sorack
I just tested, this is what happens
– Sorack
Just completing, let’s say you want to send this project to me, it would be impossible to send me the node_modules folder, for that, there is package.json. You just send me the package.json and the files you programmed and I use an npm install on my machine, this npm install will read the package.json and install the dependencies.
– André
So this package.json records all the modules I installed? including their version?
– Luhhh
Exactly. Serves precisely to ensure that you will have the same dependencies in tds places, among other utilities
– Sorack
Cool. When I save my project to git, won’t modules come together then? Just my project?
– Luhhh
Yeah, that’s the idea, you can give a
ignore
in the briefcasenode_modules
– Sorack
got it. To close, when I clone the git project, don’t you need to install npm NOMEDOMODULO? Does it automatically get from package.json? Or have some npm update I know there....
– Luhhh
has to give a single command:
npm install
– Sorack
By typing npm install it searches all package dependencies and installs modules?
– Luhhh
Exactly. You exchange for only 1 command avoiding errors
– Sorack