New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why recommend to commit node_modules for deployment? #622

Closed
manast opened this Issue Aug 7, 2014 · 12 comments

Comments

4 participants
@manast

manast commented Aug 7, 2014

I think this is a big mistake, will cause more problems that it solves, why not use npm shrinkwrap instead which does the same but without needing to commit a lot of unnecessary code to git?

https://www.npmjs.org/doc/cli/npm-shrinkwrap.html

@rlidwka

This comment has been minimized.

Show comment
Hide comment
@rlidwka

rlidwka Aug 7, 2014

Collaborator

Sometimes it is a mistake, sometimes it is not, it depends on your workflow really.

Collaborator

rlidwka commented Aug 7, 2014

Sometimes it is a mistake, sometimes it is not, it depends on your workflow really.

@manast

This comment has been minimized.

Show comment
Hide comment
@manast

manast Aug 7, 2014

could you describe a workflow where you need to commit node_modules and shrinkwrap would not work?

manast commented Aug 7, 2014

could you describe a workflow where you need to commit node_modules and shrinkwrap would not work?

@rlidwka

This comment has been minimized.

Show comment
Hide comment
@rlidwka

rlidwka Aug 7, 2014

Collaborator

git bisect ?

Collaborator

rlidwka commented Aug 7, 2014

git bisect ?

@manast

This comment has been minimized.

Show comment
Hide comment
@manast

manast Aug 7, 2014

what does that mean? :)

manast commented Aug 7, 2014

what does that mean? :)

@rlidwka

This comment has been minimized.

Show comment
Hide comment
@rlidwka

rlidwka Aug 7, 2014

Collaborator

Well it is one of the major advantages of having node_modules checked in.

Collaborator

rlidwka commented Aug 7, 2014

Well it is one of the major advantages of having node_modules checked in.

@manast

This comment has been minimized.

Show comment
Hide comment
@manast

manast Aug 7, 2014

sure, but can you explain when do you use git bisect, and what problems does it solve?

manast commented Aug 7, 2014

sure, but can you explain when do you use git bisect, and what problems does it solve?

@rlidwka

This comment has been minimized.

Show comment
Hide comment
@rlidwka

rlidwka Aug 7, 2014

Collaborator

This isn't really the place to discuss this, since it has nothing to do with pm2. Here is one opinion about it that makes sense: http://www.futurealoof.com/posts/nodemodules-in-git.html

It should probably be removed/changed in README though, because it's not "best practice", it's just one of possible setups.

Collaborator

rlidwka commented Aug 7, 2014

This isn't really the place to discuss this, since it has nothing to do with pm2. Here is one opinion about it that makes sense: http://www.futurealoof.com/posts/nodemodules-in-git.html

It should probably be removed/changed in README though, because it's not "best practice", it's just one of possible setups.

@manast

This comment has been minimized.

Show comment
Hide comment
@manast

manast Aug 7, 2014

I think this is a legitimate issue since pm2 supports deployment now. The post you mentioned is from 2011 when npm shrinkwrap was not available.

manast commented Aug 7, 2014

I think this is a legitimate issue since pm2 supports deployment now. The post you mentioned is from 2011 when npm shrinkwrap was not available.

@soyuka soyuka closed this in 3b3bf8e Aug 10, 2014

@Unitech

This comment has been minimized.

Show comment
Hide comment
@Unitech

Unitech Aug 10, 2014

Owner

Embedding dependencies make your app more independent.
I totally agree that npm shrinkwrap is a good solution but if you use that with pm2-deploy add the npm install command on the post-deploy hook.

"post-deploy" : "npm install && pm2 startOrRestart ecosystem.json --env production"
Owner

Unitech commented Aug 10, 2014

Embedding dependencies make your app more independent.
I totally agree that npm shrinkwrap is a good solution but if you use that with pm2-deploy add the npm install command on the post-deploy hook.

"post-deploy" : "npm install && pm2 startOrRestart ecosystem.json --env production"
@manast

This comment has been minimized.

Show comment
Hide comment
@manast

manast Aug 10, 2014

In my experience committing dependencies may work if you are the only developer on an app, as soon as there are several it becomes problematic, you really don't want to handle merge conflicts on the modules you depend on. This problems grows exponentially with the amount of developers working simultaneously...

manast commented Aug 10, 2014

In my experience committing dependencies may work if you are the only developer on an app, as soon as there are several it becomes problematic, you really don't want to handle merge conflicts on the modules you depend on. This problems grows exponentially with the amount of developers working simultaneously...

@manast

This comment has been minimized.

Show comment
Hide comment
@manast

manast Aug 10, 2014

@Unitech good tip, maybe you could add it to the README as well?

manast commented Aug 10, 2014

@Unitech good tip, maybe you could add it to the README as well?

soyuka added a commit that referenced this issue Aug 10, 2014

@LoicMahieu

This comment has been minimized.

Show comment
Hide comment
@LoicMahieu

LoicMahieu Aug 11, 2014

Contributor

In our deployment process, we commit node_modules and other files generated from the build in a separate production branch and we push it to a separate repositories (all team members don't have access to production repos, Gitlab handle that perfectly ❤️ ! )
In production servers, just a git checkout and npm rebuild and your app is ready to be started.

Contributor

LoicMahieu commented Aug 11, 2014

In our deployment process, we commit node_modules and other files generated from the build in a separate production branch and we push it to a separate repositories (all team members don't have access to production repos, Gitlab handle that perfectly ❤️ ! )
In production servers, just a git checkout and npm rebuild and your app is ready to be started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment