mrbungle64 / ecovacs-deebot.js

A Node.js library for running Ecovacs Deebot and yeedi vacuum cleaner robots
GNU General Public License v3.0
118 stars 37 forks source link

app2.js - cannot find module #77

Closed unclej84 closed 3 years ago

unclej84 commented 3 years ago

Hi,

I tried the current version of app2.js today and got following error in console:

`[EcovacsMQTT_JSON] callEcovacsDeviceAPI failed for cmd getMapSubSet: Error: Cannot find module '../build/Release/canvas.node' Require stack:

unclej84 commented 3 years ago

Tested on node-red docker container. Seems no python is available to build the package. Same issue seems to be on RedMatic installation

unclej84 commented 3 years ago

Installation for canvas on debian based systems (e.g. RaspberryOS, Debian, Ubuntu):

apt install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev libpixman-1-dev

Installation for canvas on alpine based systems (e.g. Node-RED docker container):

apk add --no-cache build-base g++ cairo-dev jpeg-dev pango-dev giflib-dev

mrbungle64 commented 3 years ago

Installation for canvas on debian based systems (e.g. RaspberryOS, Debian, Ubuntu):

apt install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev libpixman-1-dev

Installation for canvas on alpine based systems (e.g. Node-RED docker container):

apk add --no-cache build-base g++ cairo-dev jpeg-dev pango-dev giflib-dev

Did this fix the problem? I was just about to answer you 😉

unclej84 commented 3 years ago

This error is gone after adding the dependencies - issue was that there is no pre-build binary for the platform canvas so it had to be build. Therefor these packages were needed. So the app2.js was running afterwards. I am still searching for a solution for aarch6 based system (RaspberryMatic).

mrbungle64 commented 3 years ago

@unclej84

Canvas is an optional dependency. Currently it's only necessary for DeebotPositionCurrentSpotAreaID event.

unclej84 commented 3 years ago

Are you sure? Before I did not get any feedback for GetSpotAreaInfo but after it works like a charme

mrbungle64 commented 3 years ago

@unclej84

I have installed canvas on all of my systems so I can not check this right now, but I just made a commit where I removed GetMaps cmd in app2.js from the interval. This might solve a few of your current problems 😉

mrbungle64 commented 3 years ago

@unclej84

Are you sure? ...

I just uninstalled canvas one of my systems and it still works properly (OZMO 920)

unclej84 commented 3 years ago

Maybe I did not describe it correct and the issue is wrong here. The app2.js receives a response with the Spot Area Info and then throws the error above. [app2.js] MapDataObject and [VacBot] *** MapSpotAreaInfo are never logged but I get [EcovacsMQTT_JSON] handleCommand() command getMapSubSet received event: for the [VacBot] action: GetSpotAreaInfo request.

When having installed the packages above on the fresh image and logging again I get [app2.js] MapDataObject shortly after start.

Maybe I am too stupid to test but that is what I get. And as the app2.js output is not triggered, the same result I get with the node-red-package - no response with MapDataObject for GetMaps or MapSpotAreaInfo for GetSpotAreaInfo.

I it would help, I can provide the captured logs of both situations

unclej84 commented 3 years ago

These are the steps I made:

  1. mkdir node-red-dev && cd node-red-dev/ && git clone https://github.com/mrbungle64/ecovacs-deebot.js.git
  2. docker run -d -p 1880:1880 -v node_red_data:/data -v /home/<username>/node-red-dev:/usr/src/dev --name mynodered nodered/node-red:latest-12 [~/node-red-dev contains the git clone of the github repo]
  3. docker exec -it mynodered /bin/bash
  4. cd /usr/src/dev/ecovacs-deebot.js/
  5. npm install
  6. cd example
  7. NODE_ENV=dev node app2.js > log.txt

for the second test with packages installed I added these steps after 1.:

mrbungle64 commented 3 years ago

@unclej84

Please send me the ouptut of log.txt via mail. I'll have a look at it later.

unclej84 commented 3 years ago

Confirmed - I am too stupid to test!! As I used a mounted folder all the time there was a node_modules folder existing. Tested without the mount and doing the git clone directly inside the container to /tmp it worked and I got the output of [app2.js] MapDataObject

I am so sorry for the confusion - I need to prepare my testing env more carefully. So I guess we can close this.

mrbungle64 commented 3 years ago

So I guess we can close this.

ok, I will put the instructions for alpine based systems in the wiki

Installation for canvas on alpine based systems (e.g. Node-RED docker container): apk add --no-cache build-base g++ cairo-dev jpeg-dev pango-dev giflib-dev