I programmed a NodeJs Express backend on my PC and when I start it, everything works fine. Now I managed to install NodeJs and npm with the same versions as on my PC, on my Raspberry Pi with Raspbian Lite on it. Now I want to host my backend on it (just localy). First everything looks fine but after 5 seconds, this error appears:
node:internal/modules/cjs/loader:1183
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: /home/Raspbius/servers/humaster/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: invalid ELF header
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/Raspbius/servers/humaster/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/Raspbius/servers/humaster/server.js:7:16)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
code: 'ERR_DLOPEN_FAILED'
}
I have no clue how to solve it because on my PC everything works fine with the exact same package.
Thanks in advance!
Related
I am trying to deploy my code on vercel but I get the following error
my code : https://github.com/Dhanush-git/github-banner-generator
undefined ERROR Error: libfontconfig.so.1: cannot open shared object file: No such file or directory
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1144:18)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at Object.<anonymous> (/var/task/node_modules/skia-canvas/lib/index.js:23:29)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12) {
code: 'ERR_DLOPEN_FAILED'
}
I've been to trying to get my hands off this by reinstalling node.js but keeps giving me same issues.
Error: \\?\C:\Users\iSel Media\Desktop\wickrio_web_interface-master\node_modules\wickrio_addon\wickrio_addon.node is not a valid Win32 application.
\\?\C:\Users\iSel Media\Desktop\wickrio_web_interface-master\node_modules\wickrio_addon\wickrio_addon.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1187:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\iSel Media\Desktop\wickrio_web_interface-master\node_modules\wickrio-bot-api\src\WickrIOBot.js:1:20)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
code: 'ERR_DLOPEN_FAILED'
}
I have an express project and its running perfectly on my local machine (Windows).
When i try to deploy it (on ubuntu), i am getting
Error: Cannot find module '#babel/runtime/core-js/object/create'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/var/www/project/node_modules/xregexp/lib/xregexp.js:10:38)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/var/www/project/node_modules/xregexp/lib/index.js:10:39)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/var/www/project/controllers/script.js:3:15)
at Module._compile (module.js:653:30)
I tried npm install babel-runtime --save but it didn't solve anything
hit this issue this morning as well. Are you by chance using xregexp? If so, lock the version to 4.2.0 in your package.json by removing any leading carrot. "xregexp": "4.2.0"
https://github.com/slevithan/xregexp/issues/262
Update: Looks like they have fixed it in 4.2.3.
When I started app on windows I get this error:
Error: Module did not self-register.
at Object.Module._extensions..node (module.js:672:18)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\ahmet\node_modules\line-in\index.js:2:20)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
I updated all modules
I updated node
I do everything but still this error
I am trying to setup mocha to test an ExpressJs app.
When I run tests using npm test I got the following error:
TypeError: undefined is not a function
at Object.<anonymous> (/myapp/bin/www:11:18)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.cls_wrapMethod (/Users/nathanzylbersztejn/git/airdesk-api/node_modules/newrelic/lib/shimmer.js:230:38)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/nathanzylbersztejn/git/airdesk-api/controllers/session.js:13:11)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.cls_wrapMethod (/Users/nathanzylbersztejn/git/airdesk-api/node_modules/newrelic/lib/shimmer.js:230:38)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/nathanzylbersztejn/git/airdesk-api/app.js:10:25)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/nathanzylbersztejn/git/airdesk-api/test/test.js:5:11)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at /Users/nathanzylbersztejn/git/airdesk-api/node_modules/mocha/lib/mocha.js:185:27
at Array.forEach (native)
at Mocha.loadFiles (/Users/nathanzylbersztejn/git/airdesk-api/node_modules/mocha/lib/mocha.js:182:14)
at Mocha.run (/Users/nathanzylbersztejn/git/airdesk-api/node_modules/mocha/lib/mocha.js:394:31)
at loadAndRun (/Users/nathanzylbersztejn/git/airdesk-api/node_modules/mocha/bin/_mocha:349:22)
at Object.<anonymous> (/Users/nathanzylbersztejn/git/airdesk-api/node_modules/mocha/bin/_mocha:366:3)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Where /myapp/bin/www:11:5 refers to the following line:
var app = require('../app')
app.set('port', process.env.PORT || 3000); // <- this line
^
The app works well, so it's not related to the app setup.
Any idea?
First guess is you have a circular dependency, which node handles by returning an empty object until the circle is finished. Do you do something like require("./bin/www"); inside app.js?
If you post app.js and bin/www we should be able to confirm.
Second guess is app.js just isn't getting the commonjs exports correct.
I'm also pretty sure you should be able to test your express app with supertest loading just app.js and leaving bin/www just for when you launch a real server instance.