• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Trouble using pm2 to install modules

Scheduled Pinned Locked Moved General Discussion
5 Posts 2 Posters 475 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    vandam3b
    last edited by Oct 30, 2023, 11:09 PM

    Hi, I can not seem to load and modules. I reinstalled MM using the script but now no modules will load. Here is what I out in and the information I get back. Any help would be appreciated. I tried 3 different modules with no success. Thank you
    vandam3b@raspberrypi:~ $ cd MagicMirror
    vandam3b@raspberrypi:~/MagicMirror $ cd modules
    vandam3b@raspberrypi:~/MagicMirror/modules $ https://github.com/jclarke0000/MMM-MyScoreboard.git
    bash: https://github.com/jclarke0000/MMM-MyScoreboard.git: No such file or directory
    vandam3b@raspberrypi:~/MagicMirror/modules $ pm2 install https://github.com/jclarke0000/MMM-MyScoreboard.git
    [PM2][Module] Installing NPM https://github.com/jclarke0000/MMM-MyScoreboard.git module
    [PM2][Module] Module already installed. Updating.
    Deleting /home/vandam3b/.pm2/modules/MMM-MyScoreboard
    [PM2][Module] Calling [NPM] to install https://github.com/jclarke0000/MMM-MyScoreboard.git …

    added 39 packages in 22s

    1 package is looking for funding
    run npm fund for details
    [PM2][Module] Module downloaded
    ENOENT: no such file or directory, open ‘/home/vandam3b/.pm2/modules/MMM-MyScoreboard/node_modules/MMM-MyScoreboard/package.json’
    node:internal/modules/cjs/loader:1051
    throw err;
    ^

    Error: Cannot find module ‘/home/vandam3b/.pm2/modules/MMM-MyScoreboard/node_modules/MMM-MyScoreboard/package.json’
    Require stack:

    • /usr/local/lib/node_modules/pm2/lib/API/Modules/NPM.js
    • /usr/local/lib/node_modules/pm2/lib/API/Modules/Modularizer.js
    • /usr/local/lib/node_modules/pm2/lib/API.js
    • /usr/local/lib/node_modules/pm2/lib/binaries/CLI.js
    • /usr/local/lib/node_modules/pm2/bin/pm2
      at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
      at Module._load (node:internal/modules/cjs/loader:901:27)
      at Module.require (node:internal/modules/cjs/loader:1115:19)
      at require (node:internal/modules/helpers:130:18)
      at StartModule (/usr/local/lib/node_modules/pm2/lib/API/Modules/NPM.js:343:22)
      at /usr/local/lib/node_modules/pm2/lib/API/Modules/NPM.js:257:7
      at /usr/local/lib/node_modules/pm2/lib/Configuration.js:68:14
      at FSReqCallback.oncomplete (node:fs:189:23) {
      code: ‘MODULE_NOT_FOUND’,
      requireStack: [
      ‘/usr/local/lib/node_modules/pm2/lib/API/Modules/NPM.js’,
      ‘/usr/local/lib/node_modules/pm2/lib/API/Modules/Modularizer.js’,
      ‘/usr/local/lib/node_modules/pm2/lib/API.js’,
      ‘/usr/local/lib/node_modules/pm2/lib/binaries/CLI.js’,
      ‘/usr/local/lib/node_modules/pm2/bin/pm2’
      ]
      }

    Node.js v20.8.0
    vandam3b@raspberrypi:~/MagicMirror/modules $

    S 1 Reply Last reply Oct 30, 2023, 11:40 PM Reply Quote 0
    • S Away
      sdetweil @vandam3b
      last edited by Oct 30, 2023, 11:40 PM

      @vandam3b you don’t use pm2 to install modules…

      you use npm

      npm reads the package.json file to determine what libraries to install.

      if there is no package.json then there is no install to do.

      pm2, is node process manager. it’s job is to start and keep applications ruining.

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 1
      • V Offline
        vandam3b
        last edited by Oct 31, 2023, 1:31 AM

        Thanks and i down loaded a module but now I get this error.
        vandam3b@raspberrypi:~ $ pm2 start MagicMirror
        [PM2] Applying action restartProcessId on app [MagicMirror](ids: [ 0 ])
        [PM2] MagicMirror ✓
        [PM2] Process successfully started
        ┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
        │ id │ name │ mode │ ↺ │ status │ cpu │ memory │
        ├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
        │ 1 │ MM │ fork │ 369 │ online │ 131.8% │ 41.3mb │
        │ 0 │ MagicMirror │ fork │ 137 │ online │ 0% │ 4.6mb │
        └────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
        vandam3b@raspberrypi:~ $

        I looked for the MM folder but can not find it. It was working before I installed the module. This is what the config. looks like.

        /* MagicMirror² Config Sample
        *

        • By Michael Teeuw https://michaelteeuw.nl

        • MIT Licensed.

        • For more information on how you can configure this file

        • see https://docs.magicmirror.builders/configuration/introduction.html

        • and https://docs.magicmirror.builders/modules/configuration.html

        • You can use environment variables using a config.js.template file instead of config.js

        • which will be converted to config.js while starting. For more information

        • see https://docs.magicmirror.builders/configuration/introduction.html#enviromnent-variables
          */
          let 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 or empty, is “localhost”
          port: 8080,
          basePath: “/”, // The URL path where MagicMirror² is hosted. If you are using a Reverse proxy
          // you must set the sub path here. basePath must end with a /
          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”],

          useHttps: false, // Support HTTPS or not, default “false” will use HTTP
          httpsPrivateKey: “”, // HTTPS private key path, only require when useHttps is true
          httpsCertificate: “”, // HTTPS Certificate path, only require when useHttps is true

          language: “en”,
          locale: “en-US”,
          logLevel: [“INFO”, “LOG”, “WARN”, “ERROR”], // Add “DEBUG” for even more logging
          timeFormat: 24,
          units: “metric”,

          modules: [
          {
          module: “alert”,
          },
          {
          module: “updatenotification”,
          position: “top_bar”
          },
          {
          module: “clock”,
          position: “top_left”
          },
          {
          module: “calendar”,
          header: “US Holidays”,
          position: “top_left”,
          config: {
          calendars: [
          {
          fetchInterval: 7 * 24 * 60 * 60 * 1000,
          symbol: “calendar-check”,
          url: “https://ics.calendarlabs.com/76/mm3137/US_Holidays.ics”
          }
          ]
          }
          },
          {
          module: “compliments”,
          position: “top_bar”
          },
          {
          module: ‘MMM-3Day-Forecast’,
          position: ‘top_right’,
          config: {
          api_key: ‘e40b2a1224254edcecde9ccbc165c869’,
          lat: 40.658421,
          lon: -74.299593,
          units: ‘I’,
          lang: ‘en’,
          interval: 900000,
          }
          },

           {
           	module: "weather",
           	position: "",
           	header: "Weather Forecast",
           	config: {
           		weatherProvider: "openweathermap",
           		type: "forecast",
           		location: "New York",
           		locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
           		apiKey: "YOUR_OPENWEATHER_API_KEY"
           	}
           },
           {
           	module: "newsfeed",
           	position: "bottom_bar",
           	config: {
           		feeds: [
           			{
           				
           				title: "Sports",
           				url:"https://api.foxsports.com/v2/content/optimized-rss?partnerKey=MB0Wehpmuj2lUhuRhQaafhBjAJqaPU244mlTDK1i&tags=fs/cfb&size=30"	
           			
           				
           			
           			},
           		],
           		showSourceTitle: true,
           		showPublishDate: true,
           		broadcastNewsFeeds: true,
           		broadcastNewsUpdates: true
           	}
           },
          

          ]
          };

        /*************** DO NOT EDIT THE LINE BELOW ***************/
        if (typeof module !== “undefined”) {module.exports = config;}

        S 1 Reply Last reply Oct 31, 2023, 2:14 AM Reply Quote 0
        • S Away
          sdetweil @vandam3b
          last edited by sdetweil Oct 31, 2023, 9:04 PM Oct 31, 2023, 2:14 AM

          @vandam3b the process of installing modules is the same 100% of
          the time

          regardless of what the author documents

          cd ~/MagicMirror/modules
          git clone the_github_url_of_the_new_module
          cd  the_modulename  (exact case)
          if there is a file called package.json , then do 
          npm install 
          

          then add the module config entry to the list in ~/MagicMirror/config/config.js

          then restart MagicMirror
          I suggest using the npm start approach on first start after adding a module so that you can debug any issues quickly, without pm2 involvement. … then use pm2 for production again

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • V Offline
            vandam3b
            last edited by Oct 31, 2023, 12:43 PM

            Thanks you. I appreciate it.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              5/5
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy