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.

    Having issues loading library

    Scheduled Pinned Locked Moved Solved Development
    5 Posts 3 Posters 2.9k 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.
    • G Offline
      gndimitro
      last edited by paviro

      I’m trying to load annyang but during the loading of my module there is a failure, 404 not found.

      My module code is this:

      Module.register("jarvis", {
      
        // Required Scripts
        getScripts: function() {
      		return ["annyang.js"];
      	}
      });
      

      Any help would be appreciated, I added the library to package.json and installed it but it won’t load. I tried testing with moment.js and it worked, is there anywhere else I need to reference the library other than package.json?


      Note from admin: Please use Markdown on code snippets for easier reading!

      G 1 Reply Last reply Reply Quote 0
      • G Offline
        gndimitro @gndimitro
        last edited by

        @gndimitro Found the issue, I needed to copy the script to the vendor folder and modify the vendor.js script

        strawberry 3.141S MichMichM 2 Replies Last reply Reply Quote 0
        • strawberry 3.141S Offline
          strawberry 3.141 Project Sponsor Module Developer @gndimitro
          last edited by

          @gndimitro when you install a dependency with npm it’s not in your module folder, instead it will be in jarvis/node_modules/annyang/annyang.js

          getScripts: function() {
              return [this.file("node_modules/annyang/annyang.js")];
          }
          

          Please create a github issue if you need help, so I can keep track

          1 Reply Last reply Reply Quote 0
          • MichMichM Offline
            MichMich Admin @gndimitro
            last edited by

            @gndimitro FYI: to install a 3rd-party module, you should never need to modify any of the core files, like vendor.js.

            G 1 Reply Last reply Reply Quote 0
            • G Offline
              gndimitro @MichMich
              last edited by

              @MichMich Thanks! I’ll fix my code accordingly so that I won’t modify vendor.js

              1 Reply Last reply Reply Quote 1
              • 1 / 1
              • First post
                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