Read the statement by Michael Teeuw here.
How do I install dependencies using npm when MagicMirror is in a Docker?
-
Incidentally, your post said that the module from Snille “included” the Material Design Icons - where? Does the npm install command somehow download them?
Snille’s instructions say: “Install Node-Modules (The MaterialDesignIcons webfont icon names can be used.).”
What exactly does “Install Node-Modules” mean?? I haven’t done anything more than git clone his module, then ran npm install inside the docker container as you explained.
-
Hoorah! I got it working - thanks to your help :)
As you had said “The module from Snille already includes the https://materialdesignicons.com/” i decided to remove the leinich version of the module and instead installed the Snille version.
And now that I know how to run ‘npm install’ INSIDE the docker container, i did that and noticed that a directory called “node_modules” was created inside the MMM-homeassistant-sensors directory. I also noticed a “node_modules” directory inside the docker container at the ‘/opt/magic_mirror/’ level - i’ve no idea if thats meant to be there or its the result of me running ‘npm install’ whilst in the wrong directory - either way, it doesn’t seem to affect anything, so I stayed well clear of it.
After installing the Snille module and running ‘npm install’ INSIDE the docker container, i still couldn’t get my icons appearing, until i realised that the config.js for leinich’s version is subtly different to Snilles:
leinch’s says:
icons: [{ "state_off": "lightbulb-outline", "state_on": "lightbulb-on-outline" }]
whereas Snille’s says:
icons: [{ "off": "lightbulb-outline", "on": "lightbulb-on-outline" }]
so the difference being “state_off” and just “off”.
Anyway, i now have it working - so a big thank you for your help!
Hopefully my struggles will help anyone else reading this thread (in particular the bit on how to run ‘npm install’ INSIDE the docker container). Thank you.
-
Sorry - one more question:
If there is a MagicMirror2 update, and I remove my MagicMirror docker container and re-add it in order to get the latest version of MagicMirror2, do I then have to repeat the ‘npm install’ command inside the new docker container to get dependencies and MaterialDesignIcons installed? Or are the existing files & directories kept on the host OS and the MagicMirror2 container simply has links to the already existing directories on the host and so everything should just work?
-
I don’t know your docker setup but some folders (
config
,modules
,css
) should be mounted from the host. So your module data is on the host, not in the container and there is no need to runnpm install
in your module folder after updating the docker image (mm version).You have to do this if the module is updated (and uses new/updated dependencies).
-
@karsten13 Excellent - I think that’s what I was expecting to happen. Thank you so much for all your help & advice.
I hope this thread proves useful to other MagicMirror ‘newbies’ like me.