I'm developing a node.js application on a 64bit Ubuntu machine that I intend to run on a Raspberry Pi running Rasbpian. The Pi is not usually connected to the internet, so I manually copy the project folder to its SD card. I can't run the application there since one of the required modules, epoll
, apparently only works with 64 bit:
Error: /home/pi/bla/node_modules/epoll/build/Release/epoll.node: wrong ELF class: ELFCLASS64
at Object.Module._extensions..node (module.js:602:18)
at Module.load (module.js:507:32) at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at bindings (/home/pi/bla/node_modules/bindings/bindings.js:76:44)
at Object. (/home/pi/bla/node_modules/epoll/epoll.js:1:99)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
This can be fixed by running npm uninstall epoll
and then npm install epoll
, but only when the Pi is connected to the internet. Of course I could just not copy this specific module, but is there a way to avoid this error otherwise?
The problem isn't anything to do with copying, it's because your trying to run packages that have been compiled using a 64-bit Node version under a 32-bit version.
Compile your packages using the same bitness of Node on your Ubuntu system (you can install 32-bit Node on a 64-bit OS) and then copy them over.