BarryBones41
BarryBones41

Reputation: 1481

Move Node and NPM packages to offline environment

I have a node installation and many node modules installed and working on my internet machine. I need to move this to a non-internet machine.

I installed Node on the non-internet machine with no problems, but simply copy-pasting my project containing my node modules clearly was not enough. For example, I am using Gulp, and when I try to run Gulp I get gulp is not recognized as an internal or external command. However I can start node server itself just fine.

How do I successfully move a project with tons of npm modules from one machine to another?

Upvotes: 1

Views: 1039

Answers (1)

Sergey Yarotskiy
Sergey Yarotskiy

Reputation: 4804

You just running it incorrectly. Obviously when gulp being installed npm creates an alias in /url/local/bin (or whatever). This does not happen during copy/pasting. You still can run it, but you have to run it explicitly with node: node /node_modules/gulp/app.js (or whatever path is).

Also some modules use node-gyp to compile node extensions. Those extensions are also in node_modules, but they compiled for specific platform. If platform the same - probably no need to worry. If not - you will have to read node-gyp documentation.

Upvotes: 1

Related Questions