Diosney
Diosney

Reputation: 10580

Nodejs/npm: How to reinstall/recompile copied app packages

Setup:

Question:

How can I reinstall/recompile/regenerate all the app modules on the new VM without an Internet conection?

Upvotes: 7

Views: 25372

Answers (1)

Peter Lyons
Peter Lyons

Reputation: 146034

This is precisely what the npm rebuild command does. Just run npm rebuild inside your app directory after it is copied over to the new VM and any binary add-ons will be recompiled to match the current CPU architecture and node version. If the initial npm install before the copy was completely successful, the npm rebuild on the second VM will not need to download anything. Just make sure the second VM has a reasonably-close version of node and the appropriate lower level compilers, libraries, etc (build-essential and python on debian, for example).

Upvotes: 19

Related Questions