Is there a way to install node.js and npm in an unattended way (with a shell script) without building it from source? I have an array of servers that scales automatically based on server load, but downloading the Node.js source and building it using make takes like 10 minutes.
Thanks!
edit: I tried copying over the binaries, but that resulted in an error that the binary was corrupted. And yes, they are all EC2 m1.small instances.
js and npm. To publish and install packages to and from the public npm registry or a private npm registry, you must install Node. js and the npm command line interface using either a Node version manager or a Node installer.
The method described here is to package the dependencies into a tar file, then on the isolated environment, one can use the npm install <your tar file> command to install dependencies file without internet connection.
The Node. js installer carries the Node. js core file, and, consequently, the installation process installs both Node. js and npm from the installer file.
Since you're using EC2, it may help to make your own AMI. The most convenient way I have found is to:
I usually install 3-5 different versions depending on the project[1] and each has its own separate modules. Nave will sandbox the different Node versions and their modules.
Then, once you have it set up the way you like it, you can easily spawn more servers from this master copy[2]. You could technically compile every Node.js version if you wanted to but I don't find this necessary.
[1] For example, the Braintree module currently requires [email protected] while the main codebase is on [email protected].
[2] As long as you stay consistent with architecture, if you compile all of this on a m1.xlarge, you can't use the image on m1.small's because xl is 64-bit and small is 32-bit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With