Bugsounet Coding

    • Register
    • Login
    • Search
    This Forum is now reserved to registred users!

    Error: Cannot find module 'axios'

    General Discussion
    2
    12
    132
    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.
    • R
      renevandenbroek Donators last edited by

      This might be de wrong place to ask. If so, sorry.
      I try to install MMM-PoemOfTheDay and get this error. Looked around the internet but could not get a solution. Any idea what to do?

      PM2        | 2021-07-11T09:44:01: PM2 log: App [mm:0] starting in -fork mode-
      PM2        | 2021-07-11T09:44:01: PM2 log: App [mm:0] online
      
      /home/pi/.pm2/logs/mm-error.log last 400 lines:
      0|mm       | (node:1401) ExperimentalWarning: The fs.promises API is experimental
      0|mm       | [11.07.2021 09:44.03.349] [ERROR] WARNING! Could not load config file. Starting with default configuration. Error found: Error: Cannot find module 'axios'
      0|mm       | Require stack:
      0|mm       | - /home/pi/MagicMirror/modules/MMM-PoemOfTheDay/node_helper.js
      0|mm       | - /home/pi/MagicMirror/js/app.js
      0|mm       | - /home/pi/MagicMirror/js/electron.js
      0|mm       | - /home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js
      0|mm       | -
      0|mm       | [11.07.2021 09:44.03.355] [ERROR] App threw an error during load
      0|mm       | [11.07.2021 09:44.03.357] [ERROR] Error: Cannot find module 'axios'
      0|mm       | Require stack:
      0|mm       | - /home/pi/MagicMirror/modules/MMM-PoemOfTheDay/node_helper.js
      0|mm       | - /home/pi/MagicMirror/js/app.js
      0|mm       | - /home/pi/MagicMirror/js/electron.js
      0|mm       | - /home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js
      0|mm       | -
      0|mm       |     at Module._resolveFilename (internal/modules/cjs/loader.js:972:15)
      0|mm       |     at Function.n._resolveFilename (electron/js2c/browser_init.js:249:921)
      0|mm       |     at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29)
      0|mm       |     at Module._load (internal/modules/cjs/loader.js:848:27)
      0|mm       |     at Function.f._load (electron/js2c/asar_bundle.js:5:12633)
      0|mm       |     at Module.require (internal/modules/cjs/loader.js:1032:19)
      0|mm       |     at require (internal/modules/cjs/helpers.js:72:18)
      0|mm       |     at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-PoemOfTheDay/node_helper.js:2:15)
      0|mm       |     at Module._compile (internal/modules/cjs/loader.js:1152:30)
      0|mm       |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1173:10)
      0|mm       | [11.07.2021 09:44.03.364] [ERROR] Whoops! There was an uncaught exception...
      0|mm       | [11.07.2021 09:44.03.370] [ERROR] Error: Cannot find module 'axios'
      0|mm       | Require stack:
      0|mm       | - /home/pi/MagicMirror/modules/MMM-PoemOfTheDay/node_helper.js
      0|mm       | - /home/pi/MagicMirror/js/app.js
      0|mm       | - /home/pi/MagicMirror/js/electron.js
      0|mm       | - /home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js
      0|mm       | -
      0|mm       |     at Module._resolveFilename (internal/modules/cjs/loader.js:972:15)
      0|mm       |     at Function.n._resolveFilename (electron/js2c/browser_init.js:249:921)
      0|mm       |     at Function.Module._resolveFilename (/home/pi/MagicMirror/node_modules/module-alias/index.js:49:29)
      0|mm       |     at Module._load (internal/modules/cjs/loader.js:848:27)
      0|mm       |     at Function.f._load (electron/js2c/asar_bundle.js:5:12633)
      0|mm       |     at Module.require (internal/modules/cjs/loader.js:1032:19)
      0|mm       |     at require (internal/modules/cjs/helpers.js:72:18)
      0|mm       |     at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-PoemOfTheDay/node_helper.js:2:15)
      0|mm       |     at Module._compile (internal/modules/cjs/loader.js:1152:30)
      0|mm       |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1173:10) {
      0|mm       |   code: 'MODULE_NOT_FOUND',
      0|mm       |   requireStack: [
      0|mm       |     '/home/pi/MagicMirror/modules/MMM-PoemOfTheDay/node_helper.js',
      0|mm       |     '/home/pi/MagicMirror/js/app.js',
      0|mm       |     '/home/pi/MagicMirror/js/electron.js',
      0|mm       |     '/home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js',
      0|mm       |     undefined
      0|mm       |   ]
      0|mm       | }
      0|mm       | [11.07.2021 09:44.03.371] [ERROR] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
      0|mm       | [11.07.2021 09:44.03.372] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
      
      
      1 Reply Last reply Reply Quote 0
      • D
        DJB1966 Helpers last edited by

        ok here maybe fix
        in GitHub MMM-PoemOfTheDay it commands are

        cd modules 
        git clone https://github.com/Steven-Gassert/MMM-PoemOfTheDay.git
        

        they should be

        cd MagicMirror/modules
        git clone https://github.com/Steven-Gassert/MMM-PoemOfTheDay.git
        cd MMM-PoemOfTheDay
        npm install
        
        1 Reply Last reply Reply Quote 0
        • R
          renevandenbroek Donators last edited by

          thank you that did the job for the biggest part. It works now only language give a problem

          1 Reply Last reply Reply Quote 0
          • D
            DJB1966 Helpers last edited by

            what language do you need??

            1 Reply Last reply Reply Quote 0
            • R
              renevandenbroek Donators last edited by

              Dutch, nl

              1 Reply Last reply Reply Quote 0
              • D
                DJB1966 Helpers last edited by

                So you have added your API key

                detectLanguageApiKey: "{xxxxxxxxxxxxxxx}",
                

                just add ni here and remove others

                languageSet: ["ni"],
                

                see if that works.

                1 Reply Last reply Reply Quote 0
                • R
                  renevandenbroek Donators last edited by

                  Well i tried that but still no selection of the language “nl” I also tried “de” without success.
                  I renewed the API twice but that did not help it comes up with this problem:

                   toJSON: [Function: responseToJSON],
                  0|mm  |   caseless: Caseless {
                  0|mm  |     dict: {
                  0|mm  |       'content-type': 'application/json; charset=utf-8',
                  0|mm  |       'www-authenticate': 'Basic realm="Authorization Required"',
                  0|mm  |       date: 'Mon, 12 Jul 2021 09:16:00 GMT',
                  0|mm  |       'content-length': '49',
                  0|mm  |       connection: 'close'
                  0|mm  |     }
                  0|mm  |   },
                  0|mm  |   body: { error: { code: 1, message: 'Invalid API key' } },
                  0|mm  |   [Symbol(kCapture)]: false
                  0|mm  | }
                  0|mm  | [12.07.2021 11:16.01.042] [LOG]   There was an error filteringByLanguage                                                                                                             , returning all poems
                  
                  
                  1 Reply Last reply Reply Quote 0
                  • D
                    DJB1966 Helpers last edited by

                    did you try taking out {} in API

                    detectLanguageApiKey: "xxxxxxxxxxxxxxx",
                    
                    1 Reply Last reply Reply Quote 0
                    • R
                      renevandenbroek Donators last edited by

                      Yes and now it comes up with

                       url: 'https://www.poemist.com/api/v1/randompoems',
                      0|mm  |       method: 'get',
                      0|mm  |       headers: [Object],
                      0|mm  |       transformRequest: [Array],
                      0|mm  |       transformResponse: [Array],
                      0|mm  |       timeout: 0,
                      0|mm  |       adapter: [Function: httpAdapter],
                      0|mm  |       xsrfCookieName: 'XSRF-TOKEN',
                      0|mm  |       xsrfHeaderName: 'X-XSRF-TOKEN',
                      0|mm  |       maxContentLength: -1,
                      0|mm  |       validateStatus: [Function: validateStatus],
                      0|mm  |       data: undefined
                      0|mm  |     },
                      0|mm  |     request: ClientRequest {
                      0|mm  |       _events: [Object: null prototype],
                      0|mm  |       _eventsCount: 6,
                      0|mm  |       _maxListeners: undefined,
                      0|mm  |       outputData: [],
                      0|mm  |       outputSize: 0,
                      0|mm  |       writable: true,
                      0|mm  |       _last: true,
                      0|mm  |       chunkedEncoding: false,
                      0|mm  |       shouldKeepAlive: false,
                      0|mm  |       useChunkedEncodingByDefault: false,
                      0|mm  |       sendDate: false,
                      0|mm  |       _removedConnection: false,
                      0|mm  |       _removedContLen: false,
                      0|mm  |       _removedTE: false,
                      0|mm  |       _contentLength: 0,
                      0|mm  |       _hasBody: true,
                      0|mm  |       _trailer: '',
                      0|mm  |       finished: true,
                      0|mm  |       _headerSent: true,
                      0|mm  |       socket: [TLSSocket],
                      0|mm  |       connection: [TLSSocket],
                      0|mm  |       _header: 'GET /api/v1/randompoems HTTP/1.1\r\n' +
                      0|mm  |         'Accept: application/json, text/plain, */*\r\n' +
                      0|mm  |         'User-Agent: axios/0.19.0\r\n' +
                      0|mm  |         'Host: www.poemist.com\r\n' +
                      0|mm  |         'Connection: close\r\n' +
                      0|mm  |         '\r\n',
                      0|mm  |       _onPendingData: [Function: noopPendingOutput],
                      0|mm  |       agent: [Agent],
                      0|mm  |       socketPath: undefined,
                      0|mm  |       method: 'GET',
                      0|mm  |       insecureHTTPParser: undefined,
                      0|mm  |       path: '/api/v1/randompoems',
                      0|mm  |       _ended: true,
                      0|mm  |       res: [IncomingMessage],
                      0|mm  |       aborted: false,
                      0|mm  |       timeoutCb: null,
                      0|mm  |       upgradeOrConnect: false,
                      0|mm  |       parser: null,
                      0|mm  |       maxHeadersCount: null,
                      0|mm  |       reusedSocket: false,
                      0|mm  |       _redirectable: [Writable],
                      0|mm  |       [Symbol(kCapture)]: false,
                      0|mm  |       [Symbol(kNeedDrain)]: false,
                      0|mm  |       [Symbol(corked)]: 0,
                      0|mm  |       [Symbol(kOutHeaders)]: [Object: null prototype]
                      0|mm  |     },
                      0|mm  |     data: { message: 'Too Many Requests' }
                      0|mm  |   },
                      0|mm  |   isAxiosError: true,
                      0|mm  |   toJSON: [Function]
                      0|mm  | }
                      0|mm  | [12.07.2021 11:39.23.567] [LOG]
                      0|mm  | there was most likely an error fetching poems from https://www.poemist.com/api/v1/randompoems, waiting 5 mins before trying again
                      
                      

                      I don’t know how many tries are allowed

                      1 Reply Last reply Reply Quote 0
                      • R
                        renevandenbroek Donators last edited by

                        I see on the website

                        Current plan - Free
                        1,000 requests/day
                        1 MB/day
                        Free
                        

                        Because it did not select the language the 1,000 request were gone

                        1 Reply Last reply Reply Quote 0
                        • D
                          DJB1966 Helpers last edited by

                          sorry should of had glass on last nite code is nl not ni

                          1 Reply Last reply Reply Quote 0
                          • D
                            DJB1966 Helpers last edited by

                            sorry Just try it myself en works but only gets a loading.. when using nl.
                            I would try Magicmirror forum [https://forum.magicmirror.builders/](link URL) see anyone can help.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Powered by NodeBB | @bugsounet ©2022