darickc/MMM-BackgroundSlideshow

latest mm fails to start with MMM-BackgroundSlideshow enabled

ihadx opened this issue · 33 comments

ihadx commented

mm fails to start with the following in the log
[03.01.2022 13:31.49.013] [ERROR] App threw an error during load
[03.01.2022 13:31.49.014] [ERROR] Error: 'linux-armv7' binaries cannot be used on the 'linux-armvdefault' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'linux-armvdefault' platform.
at Object.hasVendoredLibvips (/home/pi/MagicMirror/modules/MMM-BackgroundSlideshow/node_modules/sharp/lib/libvips.js:82:13)
at Object. (/home/pi/MagicMirror/modules/MMM-BackgroundSlideshow/node_modules/sharp/lib/constructor.js:7:22)
at Module._compile (node:internal/modules/cjs/loader:1116:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1169:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:829:12)
at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:94:18)
at Object. (/home/pi/MagicMirror/modules/MMM-BackgroundSlideshow/node_modules/sharp/lib/index.js:3:15)
[03.01.2022 13:31.49.016] [ERROR] Whoops! There was an uncaught exception...
[03.01.2022 13:31.49.020] [ERROR] Error: 'linux-armv7' binaries cannot be used on the 'linux-armvdefault' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'linux-armvdefault' platform.
at Object.hasVendoredLibvips (/home/pi/MagicMirror/modules/MMM-BackgroundSlideshow/node_modules/sharp/lib/libvips.js:82:13)
at Object. (/home/pi/MagicMirror/modules/MMM-BackgroundSlideshow/node_modules/sharp/lib/constructor.js:7:22)

mm starts ok when MMM-BackgroundSlideshow disabled
I tried deleting the /home/pi/MagicMirror/modules/MMM-BackgroundSlideshow/node_modules/sharp folder and then running 'npm install' but it had no effect. Perhaps I didn't run 'npm install' from the right folder.
Any ideas on things to try?

Hi! Got the same problem after upgrading MM. Also disabled MMM-BackgroundSlideshow and it works. Thankful for any help.

Hi! I have the same problem on my RPi2.
Can someone check?

Thank you.

Found thats sharp module not working on arm CPUs.
This module was added in this commit
The only workaround I found for now is to checkout the commit just before this one
git checkout 8865158fd251eaca1e90703d3c4c99ffddc75de2
Hope this will help some of you while waiting for a fix.

Thank you for the feedback.
In the meantime there is any possibility to locally build the sharp module? I've already tried but I'm not expert with npm and node and I always receiver errors when starting MagicMirror after the npm install --build-from-source.
Anyone knows a guide to setup the build environment?

I've tried this solution but it did not work for me. Maybe because my installation is not fairly regular (I'm using MagicMirrorOs wich use docker on a RPi2).

I'll try to remove sharp and possibly use a different library. Unless folks find it unnecessary. It is used to resize image that are large down to the size of the screen being used so that animations run smoother.

I think it's a good feature ! Maybe you can try another library or create a tag/branch to make it simple to checkout a version without it.

I'll try to remove sharp and possibly use a different library. Unless folks find it unnecessary. It is used to resize image that are large down to the size of the screen being used so that animations run smoother.

Looking forward for a solution. Thanks !!

Hi,

for me it worked to install a self compiled version of the vips library..

  sudo apt install -y build-essential libglib2.0 libjpeg9 libopenjp2-7 librsvg2-dev imagemagick libtiff5-dev
  wget https://github.com/libvips/libvips/releases/download/v8.12.1/vips-8.12.1.tar.gz
  tar xfvz vips-8.12.1.tar.gz
  cd vips-8.12.1
  ./configure
  make
  sudo make install
  sudo ldconfig

  npm install

if a global version of vips is installed on the system the sharp package uses it instead of installing a new one.
it takes about an hour to compile vips on the pi and a lot of stuff needs to be installed but at the end it works.

@Tom-Hirschberger, great find. @clla1972 and @zatar80, do you want to try those instructions?

Hi, I made it work. I had to make a small adjustment but it finally worked.
As I'm running MagicMirror in docker on a RPi i was not able to install libjpeg9. The compilation took about 2hours but was successfull and I was able to install sharp by running the npm install command for MMM-BackgroundSlideshow!
I think since libjpeg9 is not installed, the sharp module doesn't have any effect on my pictures since they're all jpeg so I'll keep looking for a solution to install (or compile this library). If I find a solution I'll keep you guys posted!
Thanks to all of you for your help!

Just was trying a fresh install to get this setup and welp I'm having this exact issue.

If anyone has a what to do on first install Workplan... I'd appreciate it.

Filling this thread.

Ran into same issue with recent update to latest MM. The fix to separately install VIP didn't work either.

@agentsingh Did you use the os vip version or compile it by yourself. In my case the os version was still to old

When I run this line: sudo apt install -y build-essential libglib2.0 libjpeg9 libopenjp2-7 librsvg2-dev imagemagick libtiff5-dev

I have an issue with the module libglib2.0 ... it seams to be an issue with Bullseye ...

@agentsingh Did you use the os vip version or compile it by yourself. In my case the os version was still to old

@Tom-Hirschberger I followed the instructions you outlined, so compiled the version.

git checkout 8865158 worked for me ... let see next update

Hi!

I am not a tech-guy but I tried this but no Change :-(. Screen still black and same errors as before.

Best Regards
Clla1972

Hi,

for me it worked to install a self compiled version of the vips library..


  sudo apt install -y build-essential libglib2.0 libjpeg9 libopenjp2-7 librsvg2-dev imagemagick libtiff5-dev

  wget https://github.com/libvips/libvips/releases/download/v8.12.1/vips-8.12.1.tar.gz

  tar xfvz vips-8.12.1.tar.gz

  cd vips-8.12.1

  ./configure

  make

  sudo make install

  sudo ldconfig



  npm install

if a global version of vips is installed on the system the sharp package uses it instead of installing a new one.

it takes about an hour to compile vips on the pi and a lot of stuff needs to be installed but at the end it works.

@clla1972 , it didn't work for me too ... that's why I did the revert:

cd MagicMirror
cd modules
cd MMM-BackgroundSlideshow/
git reset --hard

git checkout 8865158fd251eaca1e90703d3c4c99ffddc75de2

npm install

I see a chance to reimplement the feature with the Jimp Library. The sharp Dependency then can be removed and the problem is solved. At the moment I do not have much time but I will give it a try in the next days.

https://www.geeksforgeeks.org/node-jimp-scaletofit/

https://stackoverflow.com/questions/60709561/how-convert-jimp-object-to-image-buffer-in-node

Opened a pull request #114

I am not an javascript expert so please test and review the change. I am open for feedback

Many thanks @Tom-Hirschberger !!
It works perfectly for me !!

@clla1972 , it didn't work for me too ... that's why I did the revert:

cd MagicMirror
cd modules
cd MMM-BackgroundSlideshow/
git reset --hard

git checkout 8865158fd251eaca1e90703d3c4c99ffddc75de2

npm install

Thanks. Now I reverted as well.

Many thanks @Tom-Hirschberger also !!
It works perfectly for me too !!

@Tom-Hirschberger So how do I add the needed jimp module? When I add MMM-BackgroundSlideshow to config.js I get this in the startup log:

[ERROR] Error: Cannot find module 'jimp'

Hi @vegardhw,
You need to cd in you MMM-BackgroundSlideshow module folder and run
npm install

It will download and install required modules

and don't forget to do " git checkout master" before the *git pull"

cd MagicMirror
cd modules
cd MMM-BackgroundSlideshow/
git reset --hard
git checkout master
git pull
npm install

and don't forget to do " git checkout master" before the *git pull"

cd MagicMirror
cd modules
cd MMM-BackgroundSlideshow/
git reset --hard
git checkout master
git pull
npm install

Awesome! Works like a charm.

@Tom-Hirschberger So how do I add the needed jimp module? When I add MMM-BackgroundSlideshow to config.js I get this in the startup log:

[ERROR] Error: Cannot find module 'jimp'

check #115

Hi, it is merged to the main branch now. You can add it simply by doing an npm install in the module directory.

although this merge has fixed the outlined problem for arm devices, it has caused a new problem: when using jimp, image exif data is not taken into account, causing the picture orientation to not be used when presenting pictures. This is most evident when the image is in portrait mode.

Sharp does not have this problem! So reverting the merge commit fixes this.

The current version of sharp (0.30.1) is still not compatible with arm. Maybe it is possible to to implement a fix based on the example in jimp-dev/jimp#733. The image gets rotated first and then gets processed.

PR #116 contains the code needed to rotate jpg/jpeg images based on the EXIF orientation information before they get resized by Jimp.
As EXIF is only available for jpg/jpeg images the code is only called if the file extension is ".jpg" or ".jpeg".

Edit: The branch is merged to the master now. The problem should be fixed if you use the current version. Do not forget to run

cd MMM-BackroundSlideshow
rm package-lock.json
npm install

to install the new dependency.