Local mode Node Error


#1

I have enabled local mode from the dashboard. Then ran sudo resin local push to push code locally to the device. Local mode was functioning perfect earlier in the day and I have tried a few things to fix this error but I have reached a dead end. If I push to resin master it the update and application runs ok. Any debugging tips would be greatly appreciated.

Here are the logs:

rdt push completed successfully!

  • Streaming application logs…
    sleep: using busy loop fallback
    /usr/src/app/node_modules/bindings/bindings.js:88
    throw e
    ^

Error: /usr/src/app/node_modules/ioctl/build/Release/ioctl.node: invalid ELF header
at Object.Module._extensions…node (module.js:653:18)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at bindings (/usr/src/app/node_modules/bindings/bindings.js:81:44)
at Object. (/usr/src/app/node_modules/ioctl/index.js:1:94)
at Module._compile (module.js:624:30)
at Object.Module._extensions…js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object. (/usr/src/app/node_modules/sense-hat-led/index.js:10:15)


#3

Hello,
just to make it clear, you were performing “resin local push” and was working ok, but later on you started getting that error?
Have you changed your development environment?


#4

Yes that is correct. Earlier in the day i was using local mode then later in the day started a new project folder and was able to push to resin master and build fine but local threw that error.

I did some research on that node package ioctl and there was a known error for building in environment and then moving to another. So i deleted everything on resin and on my computer tried again fresh and same error.

That lead me on some research about a npm packages called sleep that may sometimes get stuck in a infinite loop and may throw an error if it tries to start a new process and the other is still running ao i killed all terminals and processes and still the same error.

So the last straw because i wanted to use local mode was switch to use python which i uncovered many bugs with the python base images but that another ticket. However after some effort was able to get the project pushed using local mode via python but still getting errors via node.

So im fairly deep in the weeds with no idea how to debug and fix the error in Node project.


#5

Hey @elrickvm,

Can you try do the local push with the --force-build flag.

I’m wondering if it’s a problem with ‘rsync’, because if Dockerfile or any file in the ‘build-triggers’ list is changed, a new container will be built and run on your device. If not, changes will simply be synced with rsync into the application container.


#6

Huh…I will try that! I tried it with -f but not --force-build. I will try it a little later. Is there a way to remove container images from resin that i may have built in the past or no?


#7

I just tried to run sudo resin local push --force-build and get the same error with node.


#8

Do you have the latest version of resin cli?

Also, what is the node version you have?
Can you try npm install bcrypt in your environment?


#9

I have the resin-cli version 6.8.0 and i have tried several version of node 7.8.0, 7.9.0, 8.0, 8.1.3, 8.7.0, 8.8.1. Lastly, I have installed the bcrypt and still the same error.


#10

Ok so the only way that i was able to get Local Mode to work with Node is I had to delete my node_modules folder in my local repo rm -rf node_modules, do a npm install npm install sleep --save and then do sudo resin local push --force-build.

Problem is this is not reliable as it doesn’t work all the time.


#11

Another thing that i notice while debugging this is that sometime the .resin-sync.yaml does not write the environment and ignore section in the file. Not sure if that is a problem as well. Hope all my issue reports is helping. Local mode is a killer feature!!!


#14

@pimterry @hedss do you know why this would happen?


#17

Hey @elrickvm,

The short answer is that it’s expected behaviour, but I agree that this is something that should be documented better. I’ve already filed a meaty issue in https://github.com/resin-io/resin-cli/issues/708 where I explain the current behaviour and how we could improve the UX. The TL;D;R is that , environment is only saved when resin local push (re)builds the container and ignore is only saved when resin local push remote-syncs the local files instead.

Best, Kostas


#22

Ok cool. Thank you for the link ill check it out.


#23

@elrickvm how’s the situation now? I’m not certain which parts of this thread, if any, are still causing problems.


#25

The situation is one that i know how to fix now. So, if local mode fails I can get it back working. Thank you for making sure i was good. I really appreciate all of the feedback giving in this entire thread from everyone!