I have been working on migrating a project from Heroku to AWS. I have been able to successfully upload the project onto AWS without any errors, however the applications health is listed as 'Degraded'. I have been reviewing my application logs and believe the issue has something to do with me writing the code on a Mac and then Elastic Beanstalk using a Linux AMI.
"invalid ELF header" when using the nodejs "ref" module on AWS Lambda
However, this post only diagnoses the issue. There is no solution provided. I am aware that there is an architectural mismatch when moving the code from Mac to Linux. I am looking for a solution to that problem.
Here are the error messages in my applications logs:
Error: /var/app/current/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header
at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/var/app/current/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! beer#0.1.0 start: `node server/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the beer#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/.npm/_logs/2019-04-15T00_54_06_983Z-debug.log
Related
I've done everything according to the django-tailwind docs, but when I want to start the dev server I get the following error:
> theme#3.1.1 start /home/amir/projects/planning-project/src/theme/static_src
> npm run dev
> theme#3.1.1 dev /home/amir/projects/planning-project/src/theme/static_src
> cross-env NODE_ENV=development tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css -w
/home/amir/projects/planning-project/src/theme/static_src/node_modules/tailwindcss/lib/cli.js:300
throw err;
^
TypeError: Object.fromEntries is not a function
at args (/home/amir/projects/planning-project/src/theme/static_src/node_modules/tailwindcss/lib/cli.js:243:47)
at Object.<anonymous> (/home/amir/projects/planning-project/src/theme/static_src/node_modules/tailwindcss/lib/cli.js:302:3)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! theme#3.1.1 dev: `cross-env NODE_ENV=development tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css -w`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the theme#3.1.1 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/amir/.npm/_logs/2022-02-11T09_27_46_003Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! theme#3.1.1 start: `npm run dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the theme#3.1.1 start script.
I have tried going into "theme/static_src/src" directory and running npm run build-postcss, based on an answer on GitHub issue tracker, but then I get :
npm ERR! missing script: build-postcss
Turns out since I installed node via the standard servers it was an old version. You need to install a newer node version to solve this problem.
I am working on writing unit tests for API written in strapi. So I create a mocks folder to mock firebase API call.
This code works well when I am running the test with jest but when I run the application with npm run develop it gives me below error
[2020-06-02T12:14:58.977Z] debug ⛔️ Server wasn't able to start properly.
[2020-06-02T12:14:58.978Z] error ReferenceError: jest is not defined
at Object.<anonymous> (/home/backend/Documents/workspace/proj/config/functions/__mocks__/firebase.js:1:23)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at module.exports.filePath (/home/backend/Documents/workspace/proj/node_modules/strapi/lib/load/require-file-parse.js:12:10)
at loadFiles (/home/backend/Documents/workspace/proj/node_modules/strapi/lib/load/load-files.js:35:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! proj#0.1.0 develop: `strapi develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the proj#0.1.0 develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/backend/.npm/_logs/2020-06-02T12_14_58_985Z-debug.log
➜ proj git:(test) ✗
Is there any way to fix this issue ?
I am working on migrating a project from Heroku to AWS. I keep getting an error after deployment saying: 'invalid ELF header'. I have found posts with similar issues when using AWS Lambda, but I do not understand why I would have an issue with binary packages in Elastic Beanstalk.
Doesn't Elastic Beanstalk provide a configured environment to run my code similar to Docker? I feel like this problem must be more complex as I cannot find anyone else with this issue in Elastic Beanstalk.
Here is the exact error I am getting:
Error: /var/app/current/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header
at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/var/app/current/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! beer#0.1.0 start: `node server/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the beer#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/.npm/_logs/2019-04-15T00_54_06_983Z-debug.log
I am working on a Mac, my code contains both client and server code written in React, node.js, and SQL. I am uploading my code via a ZIP file containing multiple folders, including node_modules/.
Some libraries are sensitive to the operating system and / or CPU architecture on which they are built. This is especially true of modules implemented in low-level languages, or that link to system libraries. In this case, you appear to be using bcrypt which is largely written in C++.
This is one reason that the zip file you upload to Elastic Beanstalk shouldn't include your node_modules/ folder (or anything else that Git is ignoring). The easiest way to create a zip for uploading to Elastic Beanstalk is probably to use git archive:
git archive -v -o myapp.zip --format=zip HEAD
This will respect your ignores, whereas manually zipping will include them.
Your archive should include package.json and package-lock.json in its root. Elastic Beanstalk will install its own node_modules/ from these files if they are present. This should ensure that all libraries are compatible with its operating system.
After upgrading to Meteor 1.4.1.1 I can run my Meteor app without issues locally, but once uploaded to AWS Beanstalk, I am getting the error below. Any help greatly appreciated. (Uninstalling/ReInstalling Meteor did no help). I am using meteor build --server-only ../build --architecture os.linux.x86_64 command to build on Windows if that matters and then deploying to AWS Linux instances.
Error: Cannot find module 'fibers'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/app/current/programs/server/boot.js:1:75)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
npm ERR! Linux 4.4.51-40.60.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v7.6.0-linux-
x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v7.6.0-linux-
x64/bin/npm" "start"
npm ERR! node v7.6.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
I have gotten my parse server to upload to elastic beanstalk, but when I click the URL to my application on aws eb I get a 502 error every time. I have PARSE_SERVER_APPLICATION_ID,database uri, master key, and server url "serverurl"/parse.yet I am still getting this error. please help.
> parse-server#2.2.15 start /var/app/current
> node ./bin/parse-server
module.js:327
throw err;
^
Error: Cannot find module '../lib/cli/parse-server'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/var/app/current/bin/parse-server:3:1)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
npm ERR! Linux 4.4.14-24.50.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/bin/npm" "start"
npm ERR! node v4.4.6
npm ERR! npm v2.15.5
npm ERR! code ELIFECYCLE
npm ERR! parse-server#2.2.15 start: `node ./bin/parse-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the parse-server#2.2.15 start script 'node ./bin/parse-server'.
npm ERR! This is most likely a problem with the parse-server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/parse-server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs parse-server
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls parse-server
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/npm-debug.log