MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

"Error: Cannot find module 'ping' " and black screen on startup (Beginner)



  • Not sure entirely what’s happening, as I’m super new to Raspberry Pi and everything involved with it. At first, I thought it was an issue with the module (MMM-network-signal) so I removed it from my config.js but I’m still getting the error. I’ve installed all the dependencies as well.

    Any help would be appriciated!

    config (sorry for the messy code):

    /* 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: "imperial",
    
    	modules: [
    		{
    			module: "alert",
    		},
    		{
    			module: "updatenotification",
    			position: "top_bar"
    		},
    		{
    			module: "clock",
    			position: "top_left"
    		},
    		{
    			module: "calendar",
    			header: "US Holidays",
    			position: "top_left",
    			config: {
    				calendars: [
    					{
    						symbol: "calendar-check",
    						url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"					}
    				]
    			}
    		},
    		{
    			module: "MMM-network-signal",
    			position: "top_right",
        		},
    		{
    			module: "currentweather",
    			position: "top_right",
    			config: {
    				location: "Boulder",
    				locationID: "5819347",  //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
    				appid: "d78a6e9838b2fa659664f139495fda91",
    			}
    		},
    		{
    			module: "weatherforecast",
    			position: "top_right",
    			header: "Weather Forecast",
    			config: {
    				location: "Boulder",
    				locationID: "5819347",  //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
    				appid: "d78a6e9838b2fa659664f139495fda91",
    			}
    
    		},
    		{
    			module: 'MMM-OnScreenMenu',
    			position: 'bottom_right',
    			/* Valid positions: 'top_right', 'top_left', 'bottom_right', 'bottom_left' */
    			config: {
    				touchMode: true,
    				enableKeyboard: true,
    				// ... see more options below
    			}
    
    		},
        {
            module: 'MMM-Events',
            position: 'bottom_left',
            config: {
    		city: "Boulder",              // Your City
    		eventType: "music_dance,music_pop,music_easy_listening,music_folk,music_rock,music_alternative,performing_arts_musical,performing_arts_comedy,comedy,movies_film,movies_film_filmfestival",            // See Events List in ReadMe
    		when: "Next Week",             // "All", "Future", "Past", "Today", "Last Week", "This Week", "Next week", and months by name, e.g. "October"
           		mode: "noFrame",               // Frame or noFrame (around picture)
           		apikey: "SJw8XkCWk7qj8cC3",
    		rotateInterval: 5 * 60 * 1000, // New Event Appears
    		useHeader: true,
            	header: "Events",
    		maxWidth: "195px",             // adjust to your liking 
    		animationSpeed: 3000,          // Event fades in and out
            	initialLoadDelay: 4250,
            	retryDelay: 2500,
    		updateInterval: 60 * 60 * 1000, // 60 minutes. No need to change!
    		picture: false,                  // true, false = no picture
            	}
        	},
        {
            module: 'MMM-Strava',
            position: 'lower_third',
            config: {
                strava_id: '11175670',
                access_token: '225112bc74d27f282bfcb445393f1205d1440d8b'
            }
        },
    {
            module: 'MMM-MovieListings',
            position: 'bottom_right',
            config: {
        		apiKey: 'c5e8b03ed6966b680e8addc68f87afd3',
    		region: 'US',
        		language: 'en-US',
        		interface: 'poster', //'list', 'poster', 'detailed'
        		includeMoviePlot: true,
        		maxPlotLength: 198,
        		header: 'Movies',
        		moviesPerPage: 1,
        		refreshInterval: 1000 * 60 * 60 * 24, //Once a day
        		baseUrl: 'https://api.themoviedb.org/3/movie/now_playing',
        		animationSpeed: 2.5 * 1000,
        		pageChangeInterval: 30 * 1000
    		}
        	},
    	{
      		module: "MMM-NowPlayingOnSpotify",
      		position: "bottom_left",
    
      		config: {
        			clientID: "a60da971b5884399a581d132c221ce27",
        			clientSecret: "d064d24a94ca4fbb9e3efeeea6767da7",
        			accessToken: "BQDC5F33IPjzt_ksr2t1mLFtTUBOXzlq5FBDu5gKSqwxshbuM9geAGVh9y8fNqQYmN_8W9f36SdorRo6zRRX98pK8UuI62pOoJOCbeGkqKKW8x4XzY4Ol040kHIyotIS7wKMjTWTfUVbpzppP4zVw-ZL",
        			refreshToken: "AQAxiQB-7To8nb3Rv6ICfFT4mFxLGiTWS2XnKeJUi5KHatnMaMpwMvyq5ULtBKz_MEjxh5uBeyaF2cRWmOVgz3SqItqpii54rmEsHeh3Ubcl63p_y3St1skXeqx4iPOCGuj8jA",
    			showCoverArt: false
      		}
    	},
    		{
    			module: "newsfeed",
    			position: "bottom_bar",
    			config: {
    				feeds: [
    					{
    						title: "New York Times",
    						url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
    					}
    				],
    				showSourceTitle: true,
    				showPublishDate: true,
    				broadcastNewsFeeds: true,
    				broadcastNewsUpdates: true
    			}
    		},
    	]
    
    };
    
    /*************** DO NOT EDIT THE LINE BELOW ***************/
    if (typeof module !== "undefined") {module.exports = config;}
    
    


  • If it helps, here’s what the terminal spits out

    pi@raspberrypi:~/MagicMirror $ npm start
    npm WARN npm npm does not support Node.js v10.15.2
    npm WARN npm You should probably upgrade to a newer version of node as we
    npm WARN npm can't make any promises that npm will work with this version.
    npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
    npm WARN npm You can find the latest version at https://nodejs.org/
    
    > magicmirror@2.8.0 start /home/pi/MagicMirror
    > sh run-start.sh
    
    Starting MagicMirror: v2.8.0
    Loading config ...
    Loading module helpers ...
    No helper found for module: alert.
    Initializing new module helper ...
    Module helper loaded: updatenotification
    No helper found for module: clock.
    Initializing new module helper ...
    Module helper loaded: calendar
    WARNING! Could not load config file. Starting with default configuration. Error found: Error: Cannot find module 'ping'
    Loading module helpers ...
    No helper found for module: alert.
    Initializing new module helper ...
    Module helper loaded: updatenotification
    No helper found for module: clock.
    Initializing new module helper ...
    Module helper loaded: calendar
    App threw an error during load
    Error: Cannot find module 'ping'
        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-network-signal/node_helper.js:2:14)
        at Object. (/home/pi/MagicMirror/modules/MMM-network-signal/node_helper.js:35: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 'ping'
        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-network-signal/node_helper.js:2:14)
        at Object. (/home/pi/MagicMirror/modules/MMM-network-signal/node_helper.js:35: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.
    
    

  • Project Sponsor

    @keyk123 Can you edit your post and remove your keys etc?


  • Project Sponsor

    @keyk123 Can you cd into the MMM-network-signal module folder, cd ~/MagicMirror/modules/MMM-network-signal and run npm install? It requires you to run the command so that it can install all the dependencies. Try that and let us know if it solved your problem.



  • @keyk123 said in "Error: Cannot find module ‘ping’ " and black screen on startup (Beginner):

    npm WARN npm npm does not support Node.js v10.15.2

    Update npm:

    pi@raspberrypi:~ $ npm -v
    5.8.0
    
    pi@raspberrypi:~ $ cd
    pi@raspberrypi:~ $ sudo npm install npm@latest -g
    
    [ pi@raspberrypi:~ $ sudo reboot ]
    
    pi@raspberrypi:~ $ npm -v
    6.10.3
    

    When in doubt if you’re config.js is okay, always run:

    pi@raspberrypi:~ $ cd ~/MagicMirror; npm run config:check
    

Log in to reply