yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.37k stars 2.72k forks source link

Node.js start fails on Linux platform due to invalid ELF header error #9058

Closed zN3utr4l closed 1 month ago

zN3utr4l commented 1 month ago

I'm trying to create a nodejs app on windows that only runs on linux, when building I install the dependencies like this "SET "npm_config_arch=ia32" ; SET "npm_config_target_arch=ia32" ; SET "npm_config_platform=linux" ; Yarn install" (as suggested here https://github.com/yarnpkg/yarn/issues/2221#issuecomment-872021336)

but it goes wrong

/home/pi/test/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:57
throw err;
^

Error: /home/pi/test/node_modules/sqlite3/build/Release/node_sqlite3.node: invalid ELF header
at Module._extensions..node (node:internal/modules/cjs/loader:1452:18)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at require (node:internal/modules/helpers:177:18)
at bindings (/home/pi/test/node_modules/bindings/bindings.js:112:48)
at Object.<anonymous> (/home/pi/test/node_modules/sqlite3/lib/sqlite3-binding.js:1:37)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32) {
code: 'ERR_DLOPEN_FAILED'
}

Node.js v18.19.1

if I install everything directly on raspberry it obviously works, but I need node_modules to be created on my machine, which is not raspberry

Daniel15 commented 1 month ago

This is an issue with the "sqlite3" package, not with Yarn If you first installed on a Raspberry Pi, it's possible that node_sqlite3.node is an ARM executable, not an x86-64 one. Try run yarn install again.