I copied the node_modules directly and ran npm on other machines.
module.js:598
return process.dlopen(module, path._makeLong(filename));
^
Error: /opt/data/appstore/aa_ci/jenkinswork/jobs/member-web/workspace/member-web/static/node_modules/sharp/build/Release/sharp.node: invalid ELF header
at Object.Module._extensions..node (module.js:598:18)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/opt/data/appstore/aa_ci/jenkinswork/jobs/member-web/workspace/member-web/static/node_modules/sharp/lib/constructor.js:9:15)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
npm ERR! Linux 2.6.32-431.el6.x86_64
npm ERR! argv "/application/node-v7.3.0-linux-x64/bin/node" "/application/node-v7.3.0-linux-x64/bin/npm" "run" "build"
npm ERR! node v7.3.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `node build/build.js && cd dist && gulp && rimraf gulpfile.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script 'node build/build.js && cd dist && gulp && rimraf gulpfile.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the member package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build/build.js && cd dist && gulp && rimraf gulpfile.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs member
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls member
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /opt/data/appstore/aa_ci/jenkinswork/jobs/member-web/workspace/member-web/static/npm-debug.log
npm ERR! Linux 2.6.32-431.el6.x86_64
npm ERR! argv "/application/node-v7.3.0-linux-x64/bin/node" "/application/node-v7.3.0-linux-x64/bin/npm" "run" "test"
npm ERR! node v7.3.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test: `cross-env NODE_ENV=test npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script 'cross-env NODE_ENV=test npm run build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the member package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cross-env NODE_ENV=test npm run build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs member
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls member
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
[admin@172-25-16-198 zhump]$ uname -a
Linux 172-25-16-198 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[admin@172-25-16-198 zhump]$ npm i sharp -D
> [email protected] install /home/admin/zhump/node_modules/sharp
> node-gyp rebuild
ERROR: glibc version 2.12 requires manual installation - please see http://sharp.dimens.io/en/stable/install/
gyp: Call to 'LDD_VERSION="ldd (GNU libc) 2.12
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper." node -e "require('./binding').download_vips()"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/home/admin/.nvm/versions/node/v7.3.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 2.6.32-431.el6.x86_64
gyp ERR! command "/home/admin/.nvm/versions/node/v7.3.0/bin/node" "/home/admin/.nvm/versions/node/v7.3.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/admin/zhump/node_modules/sharp
gyp ERR! node -v v7.3.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! Linux 2.6.32-431.el6.x86_64
npm ERR! argv "/home/admin/.nvm/versions/node/v7.3.0/bin/node" "/home/admin/.nvm/versions/node/v7.3.0/bin/npm" "i" "sharp" "-D"
npm ERR! node v7.3.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sharp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sharp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls sharp
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/admin/zhump/npm-debug.log
help me ~
"I copied the node_modules directly and ran npm on other machines."
npm install has to be run on the same architecture/platform as used at run time.
ERROR: glibc version 2.12 requires manual installation - please see http://sharp.dimens.io/en/stable/install/
This looks like Centos OS 6, please see http://sharp.dimens.io/en/stable/install/#linux
For 32-bit Intel CPUs and older Linux-based operating systems such as Centos 6, it is recommended to install a system-wide installation of libvips from source:
https://github.com/jcupitt/libvips#building-libvips-from-a-source-tarball
These questions have come up before, please see #434 #626 #800
If you are packaging and deploying using serverless-webpack, deploy the Serverless service using an Amazon Linux docker image.
Building the project using the Sharp Lambda install instructions did not resolve the invalid ELF header error because the OSX serverless-webpack build created a new incompatible version sharp.node file.
From the root of your project directory, run shell on docker image
docker run -it -v "$PWD":/var/task lambci/lambda:build-nodejs6.10 /bin/bash
npm install your project
npm install
globally install the Serverless Framework node.js CLI on your Amazon Linux container
npm install -g serverless
set your AWS credentials environment variables
export AWS_ACCESS_KEY_ID=[REDACTED]
export AWS_SECRET_ACCESS_KEY=[REDACTED]
Deploy the service
serverless deploy
Most helpful comment
OSX serverless-webpack Tip
If you are packaging and deploying using serverless-webpack, deploy the Serverless service using an Amazon Linux docker image.
Building the project using the Sharp Lambda install instructions did not resolve the invalid ELF header error because the OSX serverless-webpack build created a new incompatible version sharp.node file.
From the root of your project directory, run shell on docker image
npm install your project
globally install the Serverless Framework node.js CLI on your Amazon Linux container
set your AWS credentials environment variables
Deploy the service