Should changes in a package.json file be commited to a repository as well?

You need to commit package.json. All other developers, after pulling the code, will just need to perform npm install to get the latest dependencies required for the project.

Whenever you or someone else wants to add new dependencies to the project you perform npm install <dependencyName> or npm install --save-dev <dependencyName>. Then package.json is automatically updated, and needs to be committed again.

Note: dependencies should not be committed, so you need to add node_modules to the .gitignore file (supposing you use git), and commit this file also.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)