My problem is that whenever I install any dependency using npm install --save
then the dependency gets installed but, after I push my code on git and someone else pulls the code, he faces the issue that dependency is missing. Then that person needs to do npm install
again to install the dependency. How to solve this? What command should I run so that the dependency is added automatically to the other persons desktop?
You could do that, but you should not be doing that. IF u want to do that then all what you have to do is to track the node_modules folder from git, however again this is extremely not recommended .
The normal flow is to do what you exactly did, you declare the packages, and later anyone that wants to work on the project, they have to reinstall them.
There are many reasons that the normal flow is like what you described, and that it is not recommended to push node_modules to git, here are some of them:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.