Docker setup is not working
Here is my use-case: I want to create a module for MM and I want to have MM running in sever mode as a docker on my PC to create-n-debug module locally first and then deploy it to Raspberry.
Ok, current docker instructions from github doesn’t work, but np, Dockerfile is ok. So I pulled “master”, fixed config (just whitelisted all IPs) and created docker image locally based on it (docker image build < path to local repo >). Then I create container from it, go to web-server’s address and see empty black screen. Starting to debug and see that few HTTP requests end with 404. Here they are:
- “NetworkError: 404 Not Found - http://192.168.99.100/vendor/node_modules/moment/min/moment-with-locales.js”
- “NetworkError: 404 Not Found - http://192.168.99.100/vendor/node_modules/moment-timezone/builds/moment-timezone-with-data.js”
- “NetworkError: 404 Not Found - http://192.168.99.100/vendor/node_modules/font-awesome/css/font-awesome.min.css”
- “NetworkError: 404 Not Found - http://192.168.99.100/vendor/node_modules/weathericons/css/weather-icons.css”
- clock.js (line 49, column 3) ReferenceError: moment is not defined
- clock.js (line 77, column 7) ReferenceError: moment is not defined
Ok, what I did is logged into container and ls-ed to /vendor dir and realize there are really no such files. I’ve searched through gitlab repo and realized there are no such files too.
I’ve looked through issues and realize that pull request https://github.com/MichMich/MagicMirror/pull/846 is not going to fix issue that I’m experiencing. Moreover dockerfile from this PR is not building on my PC.
I’m not an expert in NodeJs but I assume list of possible problems are following:
- I’m missing something
- Docker installation scripts doesn’t contain some instructions that exists in Raspberry installation scripts and nobody really using docker so I’m the first to see this issue
- Those files are somehow dynamic and appear at runtime (or some mod_rewrite works), but I don’t see why they are not work and see no rules for those files to proceed dynamically (search through code by “moment” doesn’t show anything that rings the bell for me).
Windows 7 64-bit
Dockertools Server Version: 17.04.0-ce
Appreciate any hints how this can be solved.
Ready to contribute a fix (to code or documentation) if it will be needed
karsten13 last edited by
replacing “npm install” with “npm install --unsafe-perm” solved my blackscreen problem.
@z0diak those files have to be installed with
npm installin the vendor directory or run
npm installin MagicMirror directory which automatically installs the vendor as well.
Initiated container, ran “npm install” and here are results:
# npm install npm info it worked if it ends with ok npm info using firstname.lastname@example.org npm info using email@example.com npm info lifecycle firstname.lastname@example.org~preinstall: email@example.com npm info linkStuff firstname.lastname@example.org npm info lifecycle email@example.com~install: firstname.lastname@example.org npm WARN lifecycle email@example.com~install: cannot run in wd %s %s (wd=%s) mag firstname.lastname@example.org cd vendor && npm install /opt/magic_mirror npm info lifecycle email@example.com~postinstall: firstname.lastname@example.org npm WARN lifecycle email@example.com~postinstall: cannot run in wd %s %s (wd=%s) firstname.lastname@example.org sh installers/postinstall/postinstall.sh /opt/magic_mirror npm info ok # ls vendor package.json vendor.js
Unless I use --unsage-perm it just doesn’t work. Thanks to you and @karsten13
@MichMich should this be submitted as an issue to GitHub?
karsten13 last edited by
The docker setup is outsourced to https://github.com/bastilimbach/docker-MagicMirror and I already posted an issue for the black screen problem there: https://github.com/bastilimbach/docker-MagicMirror/issues/2
I added the
--unsafe-permto the npm install process in the Dockerfile. (3a5dbc4) This should fix the issues