The binary, npm, that you install is platform dependent, as is node.js. That's why there are different releases for each platform available on the download site.
For the most part, your project files are platform independent. For example, most of your JavaScript files will all be used by node.js and work just fine without having to worry about what platform you are on because the system details will be dealt with by node.js itself.
However, some modules are platform dependent. For example, anything that uses node-gyp will try to compile on your platform whenever the module is installed by npm. You do not have to worry about that though because it is handled by npm, that's why you're using a package manager.
Copying node_modules
can be done; but it's more often than not better and easier to just run npm i
on whatever machine is going to be running your application. You can avoid having to worry about version problems using something like npm shrinkwrap
which will lock down the version of a package that your module depends on.
node-modules
folder, and usingnpm install
. The error I got was:[Error: %1 is not a valid Win32 application. \\?\D:\~\node_modules\mongodb\node_modules\bson\build\Releas e\bson.node] js-bson: Failed to load c++ bson extension, using pure JS version fs.js:844 return binding.stat(pathModule._makeLong(path));