Cross-compile node module with native bindings with node-gyp
While not really a solution to your problem, a very easy workaround could be to simply compile the native addons on a Linux machine.
For your particular situation, I would use Vagrant. Vagrant can create virtual machines and configure them within seconds.
- Find an OS image that resembles Amazon's Linux distro (Fedora, CentOS, others that use
yum
as package manager - see Wiki) - Use a simple configuration script that, when run by Vagrant on machine startup, will run
npm install
(optionally it might also remove the node_modules folder before to ensure a clean installation) - For extra comfort, the script can also create the zip file for deployment
- Once the installation finishes, the script will shutdown the VM to avoid unnecessary consumption of system resources
- Deploy!
It might require some tuning if the linked libraries are not at the same place on the target machine but generally this seems to me like the best and quickest solution.
How to yum install Node.JS on Amazon Linux
Stumbled onto this, was strangely hard to find again later. Putting here for posterity:
sudo yum install nodejs npm --enablerepo=epel
EDIT 3: As of July 2016, EDIT 1 no longer works for nodejs 4 (and EDIT 2 neither). This answer (https://stackoverflow.com/a/35165401/78935) gives a true one-liner.
EDIT 1: If you're looking for nodejs 4, please try the EPEL testing repo:
sudo yum install nodejs --enablerepo=epel-testing
EDIT 2: To upgrade from nodejs 0.12 installed through the EPEL repo using the command above, to nodejs 4 from the EPEL testing repo, please follow these steps:
sudo yum rm nodejs
sudo rm -f /usr/local/bin/node
sudo yum install nodejs --enablerepo=epel-testing
The newer packages put the node binaries in /usr/bin
, instead of /usr/local/bin
.
And some background:
The option --enablerepo=epel
causes yum
to search for the packages in the EPEL repository.
EPEL (Extra Packages for Enterprise Linux) is open source and free community based repository project from Fedora team which provides 100% high quality add-on software packages for Linux distribution including RHEL (Red Hat Enterprise Linux), CentOS, and Scientific Linux. Epel project is not a part of RHEL/Cent OS but it is designed for major Linux distributions by providing lots of open source packages like networking, sys admin, programming, monitoring and so on. Most of the epel packages are maintained by Fedora repo.
Via http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/
Upgrade Kubernetes Cluster using Terraform's provisioner
Finally, I was able to resolve this which means a K8s minor upgrade is successful. Below steps were followed during the course:
- Deploy a K8s cluster running version 1.11.2
- Double the node count, change version to 1.11.5 and re-deploy
- New nodes get created with updated version
- Remove nodes running old version i.e. 1.11.2
- Run
terraform refresh
so as to sync statefile with real world running Infrastructure - Change the node count to 3 or half it.
- Run
terraform plan
and verify (multiple runs of refresh might be needed) - Run
terraform apply
to apply changes. - Statefile should be in sync with remote
- Run terraform plan which shouldn’t show any resources to be created
I will be trying a major version upgrade shortly and post the results here.
invalid ELF header when using the nodejs ref module on AWS Lambda
This happens when you build on one architecture and then attempt to use the same built addon on a different architecture (or platform in some cases).
According to this page, addons may have to be compiled against an Amazon Linux image on EC2 in order for the compiled addons to be usable on their Lambda service.
Related Topics
Sqlite Data File on Linux and Os X Incompatible
Enabling The Vt-X Inside a Virtual Machine
Unexpected Periodic Behaviour of an Ultra Low Latency Hard Real Time Multi-Threaded X86 Code
How to Change Port Gitlab on Centos 6
Bash "&" Without Printing "[1]+ Done "
Prevent R from Using Virtual Memory on Unix/Linux
Emacs/Xterm Color Annoyance on Linux
Return Values from Bash Script
Git Error: Cannot Handle Https
Program Life in Terms of Paged Segmentation Memory
How to Distinguish Between Different Operating System Distros in Node.Js
Error: Nvidia-Smi Has Failed Because It Couldn't Communicate with The Nvidia Driver