Node/ npm error? Blank magicmirror. Please help - desperate, frustrated and grateful for the right direction



  • Hello,

    I am trying to amke a magicmirror for my wife - this was supposed to be an easy Christmas present. I am pretty well versed with Arduino and Pis, so I thought it will be straightforward. But, reality was very different.

    I am getting a blank screen. My output from npm start in MagicMirror directory is:

    pi@magicmirror:~/MagicMirror $ npm start
    
    > magicmirror@2.9.0 start /home/pi/MagicMirror
    > sh run-start.sh
    
    Starting MagicMirror: v2.9.0
    Loading config ...
    Loading module helpers ...
    No helper found for module: alert.
    Initializing new module helper ...
    Module helper loaded: updatenotification
    WARNING! Could not load config file. Starting with default configuration. Error found: Error: Cannot find module 'googleapis'
    Loading module helpers ...
    No helper found for module: alert.
    Initializing new module helper ...
    Module helper loaded: updatenotification
    App threw an error during load
    Error: Cannot find module 'googleapis'
        at Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
        at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/electron/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
        at Function.Module._load (internal/modules/cjs/loader.js:528:25)
        at Module.require (internal/modules/cjs/loader.js:658:17)
        at require (internal/modules/cjs/helpers.js:20:18)
        at Object. (/home/pi/MagicMirror/modules/MMM-Buller/node_helper.js:14:18)
        at Object. (/home/pi/MagicMirror/modules/MMM-Buller/node_helper.js:214:3)
        at Module._compile (internal/modules/cjs/loader.js:711:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
        at Module.load (internal/modules/cjs/loader.js:620:32)
    Whoops! There was an uncaught exception...
    { Error: Cannot find module 'googleapis'
        at Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
        at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/electron/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
        at Function.Module._load (internal/modules/cjs/loader.js:528:25)
        at Module.require (internal/modules/cjs/loader.js:658:17)
        at require (internal/modules/cjs/helpers.js:20:18)
        at Object. (/home/pi/MagicMirror/modules/MMM-Buller/node_helper.js:14:18)
        at Object. (/home/pi/MagicMirror/modules/MMM-Buller/node_helper.js:214:3)
        at Module._compile (internal/modules/cjs/loader.js:711:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
        at Module.load (internal/modules/cjs/loader.js:620:32) code: 'MODULE_NOT_FOUND' }
    MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    Launching application.
    
    

    I have the following modules clones in my directory:

    • DailyXKCD
    • Beestat
    • Buller
    • DarkSkyForecast
    • Lyft
    • Fitbit
    • MyCommute
    • Bring
    • DailyPokemon
    • MBTA
    • pi-hole-stats

    I am using a Raspberry pi 3, and installed MM using the curl script. The first alarm was whenever I tried using npm install inside a module directory. I got a node.js incompatibility command. I was on 10.something, and following the text updated to latest version of 9.something. After that, the npm warning of incompatible version went away, but the following still comes up:

    
    pi@magicmirror:~/MagicMirror/modules/MMM-Buller $ npm install
    npm WARN Invalid version: "1.0"
    npm WARN MMM-Buller No description
    npm WARN MMM-Buller No repository field.
    npm WARN MMM-Buller No README data
    npm WARN MMM-Buller No license field.
    

    Is this a catastrophic warning? I do not think my config.json is an issue. npm run config:check outputs:

    pi@magicmirror:~/MagicMirror $ npm run config:check
    
    > magicmirror@2.9.0 config:check /home/pi/MagicMirror
    > node tests/configs/check_config.js
    
    Checking file...  /home/pi/MagicMirror/config/config.js
    Your configuration file doesn't contain syntax errors :)
    

    Also, for some reason, npm does not recognize `npm audit’ command.

    I know it is a lot of info, I will promtly try to post outputs of any validation commands.

    Lastly - my config.json is as follows:

    /* Magic Mirror Config Sample
     *
     * By Michael Teeuw http://michaelteeuw.nl
     * MIT Licensed.
     *
     * For more information how you can configurate this file
     * See https://github.com/MichMich/MagicMirror#configuration
     *
     */
    
    var config = {
    	address: "localhost", // Address to listen on, can be:
    	                      // - "localhost", "127.0.0.1", "::1" to listen on loopback interface
    	                      // - another specific IPv4/6 to listen on a specific interface
    	                      // - "", "0.0.0.0", "::" to listen on any interface
    	                      // Default, when address config is left out, is "localhost"
    	port: 8080,
    	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses
    	                                                       // or add a specific IPv4 of 192.168.1.5 :
    	                                                       // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
    	                                                       // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
    	                                                       // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
    
    	language: "en",
    	timeFormat: 12,
    	units: "metric",
    
    	// Modules //
    
    	modules: [
    		// Alert
    		{
    			module: "alert",
    		},
    		// Notifications
    		{
    			module: "updatenotification",
    			position: "top_bar"
    		},
    		// Buller - It will put out reminders and compliments
    		{
    			module: 'MMM-Buller',
    			position: 'top_bar',
    			//header: 'Buller',
    			config: {
    				debug: false,
    				lists: [
    					{
    						type: 'gTasks',
    						name: 'Compliments',
    						updateInterval: 1000 * 60 * 1 * 2, //every minutes
    						color: 'pink',
    						icon: 'fas heart'
    					},
    					{
    						type: 'gTasks',
    						name: 'Reminders',
    						icon: 'fas lightbulb-o',
    						updateInterval: 1000 * 60 * 1 * 3, //every minutes
    						color: 'blue'
    					}
    				],
    			}
    		},
    		// Clock
    		{
    			module: "clock",
    			position: "top_right",
    			config: {
    				timeFormat: '12',
    				displaySeconds: 'false',
    				showPeriod: 'true',
    				clockBold: 'true',
    				timezone: 'America/New_York' //Karachi
    			}
    		},
    		// calendar
    		{
    			module: "calendar",
    			//header: "Calenar",
    			position: "top_right",
    			config: {
    				calendars: [
    					{
    						symbol: "island-tropical",
    						url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"
    					},
    					{
    						symbol: "user-friends",
    						url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"
    					}
    				]
    			}
    		},
    		//Buller - this one will be todo in house
    		{
    			module: 'MMM-Buller',
    			position: 'top_right',
    			header: 'To Do',
    			config: {
    				debug: false,
    				lists: [
    					{
    						type: 'gTasks',
    						name: 'HomeToDo',
    						updateInterval: 1000 * 60 * 1 * 1, //every minutes
    						icon: 'fas tasks',
    					}
    				],
    			}
    		},
    		// dARKYsKY module
    		{
    			module: "MMM-DarkSkyForecast",
    			header: "XXXXX",
    			position: "top_left",
    			classes: "default everyone",
    			config: {
    				apikey: "XXXX",
    				latitude: "XXXX",
    				longitude: "XXXX",
    				iconset: "3c",
    				concise: false,
    				forecastLayout: "table",
    				units: "us",
    				maxHourliesToShow: "4",
    				maxDailiesToShow: "4",
    			}
    		},
    		// XKCD
    		{
    			module: 'DailyXKCD',
    			position: 'bottom_left',
    			config: {
    				invertColors: true,
    				showTitle: true,
    				showAltText: true,
    				randomComic: true
    			}
    		},
    		// Bring shopping list
    		{
    			module: "MMM-Bring",
    			position: "bottom_center",
    			config: {
    				email: "USER@EXAMPLE.COM",
    				password: "SECRET",
    				updateInterval: 15, // in Minutes
    				listName: "Weggies", // optional
    				showListName: true,
    				activeItemColor: "#EE524F",
    				latestItemColor: "#4FABA2",
    				showLatestItems: false,
    				maxItems: 0,
    				maxLatestItems: 0,
    				locale: "de-DE"
    			}
    		},
    		// MBTA - Main x Emerson
    		{
    			module: 'MMM-MBTA',
    			position: 'bottom_left', // This can be any of the regions.
    			header: "XXXXXx",
    			config: {
    				apikey: 'XXXX',
    				updateInterval: 30,
    				stations: 'XXX',
    				formatETA: 'true',
    				showOnly: ["Subway", "Bus"],
    				colorIcons: 'true',
    				direction: 'Inbound',
    				noETAToBack: 'false'
    			}
    		},
    		// MBTA - Davis
    		{
    			module: 'MMM-MBTA',
    			position: 'bottom_left', // This can be any of the regions.
    			header: "XXXX",
    			config: {
    				apikey: 'XXXX',
    				updateInterval: 20,
    				stations: 'XXX": "XXX',
    				formatETA: 'true',
    				showOnly: ["Subway", "Bus"],
    				colorIcons: 'true',
    				flipDirection: 'true',
    				direction: 'Inbound',
    				noETAToBack: 'false'
    			}
    		},
    		// Commute
    		{
    			module: 'MMM-MyCommute',
    			position: 'bottom_right',
    			header: 'XXXX',
    			classes: 'default everyone',
    			config: {
    				apikey: 'XXXX ',
    				origin: 'XXXX',
    				startTime: '06:00',
    				endTime: '18:00',
    				hideDays: [0,6],
    				pollFrequency: '10 * 60 * 1000',
    				destinations: [
    					{
    						destination: 'XXXX',
    						label: 'XXXX',
    						mode: 'transit',
    						color: '#82E5AA'
    					},
    					{
    						destination: 'XXXX',
    						label: 'XXXX',
    						mode: 'driving'
    					},
    					{
    						destination: 'XXXX',
    						label: 'XXXX',
    						mode: 'transit',
    						color: '#82E5AA'
    					},
    					{
    						destination: 'XXXX',
    						label: 'XXXX',
    						mode: 'driving'
    					}
    				]
    			}
    		},
    	]
    };
    
    /*************** DO NOT EDIT THE LINE BELOW ***************/
    if (typeof module !== "undefined") {module.exports = config;}
    

  • Project Sponsor Module Developer

    @nakulbende

    Was it working ever? If npm is v1 then you are seriously down level and should upgrade that.

    If it was working and stopped after an addition then remove/comment out that addition.

    It could be one of the modules you installed. You could disable all and turn them on one by one to determine which (if any) is causing the issue.

    Frankly, I would use @sdetweil’s installer script. It really is the best option and he fully supports it. It has saved many a user and I have found it quite useful. I dare say that everyone here would say the same and recommend it.

    You’ll find the url here
    https://forum.magicmirror.builders/topic/10171/anyone-want-to-try-updated-installer



  • @nakulbende @Mykle1 I agree. lets back up and start with the default config and then add one module at a time…

    so, rename your config.js

    cd ~/MagicMirror/config
    mv config.js config.js.save
    cp config.js.sample config.js
    

    and then start the mirror

    again:
    now, pic one module,
    copy the module section from the config.js.save to the config.js

    restart the mirror… verify
    save config.js

    go to again

    many modules cannot be used more than once without special handling…
    so don’t do two of anything yet

    mmm-buller only documents one dependency
    “googleapis” : “>=33.0.0”

    so, do that manually
    from the mmm-buller folder do
    npm install googleapis@33.0.0

    I don’t think u have to reinstall the base…

    let me know



  • @Mykle1 How do you update npm - when I do this, would I have to run npm install in each module folder again?

    The mirror works with default configuration just fine. I will try disabling them one by one.

    I did use the usual script bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)". How is @sdetweil’s script different?



  • Thanks all - I will install dependencies and try to add modules one by one. Is there a way to backup my installation if I do decide to reinstall using @sdetweil 's script? Would just copying the whole ~/MagicMirror folder work?



  • @nakulbende the one you used hasn’t been updated in quite some time…
    quite a few things have changed…

    my scipt, which will replace the current one on next release, has been updated and tested for about 6 months.
    see here
    https://forum.magicmirror.builders/topic/10171/anyone-want-to-try-updated-installer

    there is also a new version update script, that will help migrate from one MM release to another…
    see here https://forum.magicmirror.builders/topic/10859/new-update-upgrade-script-ready-for-testing

    to ‘backup’. just rename the MagicMirror folder, no copy, no delete…



  • @nakulbende install assumes that NO previous installation exists…so, no MagicMirror folder.

    the installer and updater both create log files so we can see what happened at the time.
    the original does not


  • Project Sponsor Module Developer

    @nakulbende said in Node/ npm error? Blank magicmirror. Please help - desperate, frustrated and grateful for the right direction:

    How do you update npm - when I do this, would I have to run npm install in each module folder again?

    I see @sdetweil has been in contact with you. You’re in good hands. Follow his directions and advice. I’m pretty sure his installer will install the correct versions of node and npm so you won’t have to do anything regarding that. Any modules you install after that (that require dependencies) will need you run npm install in their respective folders.



  • @sdetweil - your script worked flawlessly, and everything just works. I have a few kinks to sort out but it is looking like i can finish my wife’s gift before christmas after all. I can’t thank you enough!

    🙏🏽 🙇🏽

    Thank you all for pointing me in the right direction!



  • @nakulbende cool… glad it helped…

    come on back if you find some other problem!