Need to deploy node_modules on production as part of GIT and not use 'npm install'
For our project, we need to keep node_modules as part of the code base and not be in .gitignore.
When we do that, node command like "node socket.js" does not work because it is not able to find the modules.
Does "npm install" do something more than just copying the modules in node_modules?
I can see that the module folders are there, but still it give module not found error.
Like "Error: Cannot find module 'express'"
It's generally not a recommended practice to commit your node_modules directory anymore. When you run npm install there are tasks behind the scenes that node does to compile some scripts. This can differ on windows /linux / mac.
It is possible that this is the issue you are encountering.
Could I ask the reason for needing to commit this to your project base?
Some node packages need to be globally installed and also a local package. Also be sure that any requirements aren't under dev dependencies as it's not typical to deploy and run npm.