nodezoo / nodezoo-workshop

A microservices workshop for the Seneca framework.
http://senecajs.org
MIT License
185 stars 111 forks source link

Invalid ELF header error thrown #58

Open keerthivasan-r opened 8 years ago

keerthivasan-r commented 8 years ago

I have built docker images for i05 iteration using Docker quick terminal in windows 8.1. It built successfully. when i try to run using Kitematic, i get the following error.

Code: plugin_load_failed

Details: { 'orig$':
   { [Error: use-plugin: Could not load plugin mesh defined in seneca-mesh due t
o error: /node_modules/msgpack/build/Release/msgpackBinding.node: invalid ELF he
ader.]
     eraro: true,
     orig: null,
     code: 'load_failed',
     'use-plugin': true,
     package: 'use-plugin',
     msg: 'use-plugin: Could not load plugin mesh defined in seneca-mesh due to
error: /node_modules/msgpack/build/Release/msgpackBinding.node: invalid ELF head
er.',
     details:
      { options: { auto: true },
        callback: undefined,
        history:
         [ { module: '/node_modules/chairo/node_modules/seneca/seneca.js',
             path: 'mesh' },
           { module: '/node_modules/chairo/node_modules/seneca/seneca.js',
             path: 'seneca-mesh' } ],
        name: 'mesh',
        search:
         [ { type: 'normal', name: 'mesh' },
           { type: 'normal', name: 'seneca-mesh' },
           { type: 'normal', name: './mesh' },
           { type: 'normal', name: './seneca-mesh' } ],
        err: [Error: /node_modules/msgpack/build/Release/msgpackBinding.node: in
valid ELF header],
        found: { type: 'normal', name: 'seneca-mesh' },
        found_name: 'seneca-mesh',
        err_msg: '/node_modules/msgpack/build/Release/msgpackBinding.node: inval
id ELF header' },
     callpoint: 'at Seneca.api_use [as use] (/node_modules/chairo/node_modules/s
eneca/seneca.js:964:29)' },
  'message$': 'use-plugin: Could not load plugin mesh defined in seneca-mesh due
 to error: /node_modules/msgpack/build/Release/msgpackBinding.node: invalid ELF
header.' }

Stack:
    at errormaker (/node_modules/eraro/eraro.js:94:15)
    at handle_load_error (/node_modules/use-plugin/use.js:262:12)
    at loadplugin (/node_modules/use-plugin/use.js:205:13)
    at Object.use (/node_modules/use-plugin/use.js:87:7)
    at Seneca.api_use [as use] (/node_modules/chairo/node_modules/seneca/seneca.
js:964:29)
    at /srv/app-dev.js:20:8
    at module.exports (/app.js:77:3)
    at Object.<anonymous> (/srv/app-dev.js:5:14)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

Can anyone help on this?

matt-oc commented 8 years ago

Did i04 and i03 etc work for you?

stuartblair commented 8 years ago

I had a similar issue. The problem is caused when you build the docker images having first run an npm build on your host machine (your windows box in your case). That creates a node_modules directory which contains binary some binary dependencies which aren't portable between your host machine and the Linux Docker image. That's what's causing the ELF header warnings. It's saying that it doesn't understand the library header for for what it expected to be a linux shared object library.

Easy way to fix it is just to remove the node_modules directories before you build the docker containers. A better fix would be if we did an addition of node_modules into the .dockerignore file and did a wee pull request. Though since I'm far from an expert in Node, I'd love to get someone else's opinion on this as a fix.

keerthivasan-r commented 8 years ago

Ok , i will try that and let you know.

keerthivasan-r commented 8 years ago

I removed npm_modules and did npm install in the Docker terminal (Linux VM). I built the image again. when i run it, again the same error is thrown.

Seneca Fatal Error
==================

Message: seneca: use-plugin: Could not load plugin mesh defined in seneca-mesh d
ue to error: /node_modules/msgpack/build/Release/msgpackBinding.node: invalid EL
F header.

Code: plugin_load_failed

Details: { 'orig$':
   { [Error: use-plugin: Could not load plugin mesh defined in seneca-mesh due t
o error: /node_modules/msgpack/build/Release/msgpackBinding.node: invalid ELF he
ader.]
     eraro: true,
     orig: null,
     code: 'load_failed',
     'use-plugin': true,
     package: 'use-plugin',
     msg: 'use-plugin: Could not load plugin mesh defined in seneca-mesh due to
error: /node_modules/msgpack/build/Release/msgpackBinding.node: invalid ELF head
er.',
     details:
      { options: { auto: true },
        callback: undefined,
        history:
         [ { module: '/node_modules/chairo/node_modules/seneca/seneca.js',
             path: 'mesh' },
           { module: '/node_modules/chairo/node_modules/seneca/seneca.js',
             path: 'seneca-mesh' } ],
        name: 'mesh',
        search:
         [ { type: 'normal', name: 'mesh' },
           { type: 'normal', name: 'seneca-mesh' },
           { type: 'normal', name: './mesh' },
           { type: 'normal', name: './seneca-mesh' } ],
        err: [Error: /node_modules/msgpack/build/Release/msgpackBinding.node: in
valid ELF header],
        found: { type: 'normal', name: 'seneca-mesh' },
        found_name: 'seneca-mesh',
        err_msg: '/node_modules/msgpack/build/Release/msgpackBinding.node: inval
id ELF header' },
     callpoint: 'at Seneca.api_use [as use] (/node_modules/chairo/node_modules/s
eneca/seneca.js:964:29)' },
  'message$': 'use-plugin: Could not load plugin mesh defined in seneca-mesh due
 to error: /node_modules/msgpack/build/Release/msgpackBinding.node: invalid ELF
header.' }

Stack:
    at errormaker (/node_modules/eraro/eraro.js:94:15)
    at handle_load_error (/node_modules/use-plugin/use.js:262:12)
    at loadplugin (/node_modules/use-plugin/use.js:205:13)
    at Object.use (/node_modules/use-plugin/use.js:87:7)
    at Seneca.api_use [as use] (/node_modules/chairo/node_modules/seneca/seneca.
js:964:29)
    at /srv/app-dev.js:20:8
    at module.exports (/app.js:77:3)
    at Object.<anonymous> (/srv/app-dev.js:5:14)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
keerthivasan-r commented 8 years ago

@matt-oc I did try to do the same thing with i04. it just works fine. Thanks guys! Let me know if you get any findings.

sndwch commented 8 years ago

npm rebuild fixes these errors for me.