<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Error on loading script (new module not working)]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I developed a new module. It seems okay,<br />
but if i try to load it, its aborted and not able to load</p>
<p dir="auto">[GET <a href="http://localhost:8080/modules/%7Bmymodule%7D" target="_blank" rel="noopener noreferrer nofollow ugc">http://localhost:8080/modules/{mymodule}</a> net::ERR_ABORTED 404 (Not Found)]<br />
[loader.js:187 Error on loading script: modules/{mymodule}]</p>
<p dir="auto">what could be the reason for this? Well probably my module has problems, so i attached it also.</p>
<p dir="auto">Thank you</p>
<pre><code>
Module.register("mymodule",{
	defaults: {
		location: false,
		locationID: false,
		apiKey: "",
		apiBase: "https://api.openweathermap.org/data/2.5/weather",
		animationSpeed: 1000,
		updateInterval: 10 * 60 * 1000, // every 10 minutes
	},
	// Define required scripts.
	getScripts: function() {
		return ["moment.js"];
	},

	// Define required scripts.
	getStyles: function() {
		return ["mymodule.css"];
	},
	
	// No translations
	getTranslations: function() {
		return false;
	},
	
	// Define start sequence.
	  start: function() {
	    Log.info("Starting module: " + this.name);
	
	    // Set locale.
	    moment.locale(config.language);
	
	    this.type = null;
		this.temperature = null;
		this.loaded = false;
		this.initialDelay = 0;
		this.retryDelay = 2500;
		this.scheduleUpdate(this.initialDelay);
	  },
  
	getDom: function(){
		var wrapper = document.createElement("div");
	    if (this.config.apikey === "") {
	      wrapper.innerHTML = "Please set the valid APIKEY: " + this.name + ".";
	      wrapper.className = "dimmed light small";
	      return wrapper;
	    }
	
	    if (!this.loaded) {
	      wrapper.innerHTML = "LOADING";
	      wrapper.className = "dimmed light small";
	      return wrapper;
	    }
	    
	    switch(this.type){
			case "Rain":
				wrapper.classList.add("rain");
				break;
			case "Drizzle": //이슬비
				wrapper.classList.add("drizzle");
				break;
			case "Snow":
				wrapper.classList.add("snow")
				break;
			case "Thunderstorm":
				wrapper.classList.add("thunderstorm")
				break;
			case "default":
				break;
		}
		
		if(this.temperature &gt; 27){
			var hot = document.createElement("span");
			hot.classList.add("hot");
			wrapper.appendChild(hot);
		}
		return wrapper;
	},
	
	updateWeather: function(){
		if (this.config.apiKey === "") {
			Log.error("RainAndSnow: Please set APIKEY");
			return;
		}
		var url = this.config.apiBase + this.getParams();
		var self = this;
		var retry = true;

		var request = new XMLHttpRequest();
		request.open("GET", url, true);
		request.onreadystatechange = function() {
			if (this.readyState === 4) {
				if (this.status === 200) {
					self.processWeather(JSON.parse(this.response));
				} else if (this.status === 401) {
					self.updateDom(self.config.animationSpeed);

					Log.error(self.name + ": Incorrect APIKEY.");
					retry = true;
				} else {
					Log.error(self.name + ": Could not load weather.");
				}

				if (retry) {
					self.scheduleUpdate((self.loaded) ? -1 : self.retryDelay);
				}
			}
		};
		request.send();
	},
	scheduleUpdate: function(delay){
		var nextLoad = this.config.updateInterval;
		if (typeof delay !== "undefined" &amp;&amp; delay &gt;= 0) {
			nextLoad = delay;
		}
		var self = this;
		setTimeout(function() {
			self.updateWeather();
		}, nextLoad);
	},
	processWeather: function(data){
		if(!data) return;
		
		this.type = data.weather[0].main;
		this.temperature = data.main.temp - 273.15;
		this.loaded = true;
		this.updateDom(this.config.animationSpeed);
	},
	getParams: function(){
		var params = "?";
		if(this.config.locationID){
			params += "id="+this.config.locationID;
		}
		else if(this.config.location){
			params += "q="+this.config.location;
		}
		params += "&amp;appid="+this.config.apiKey;
		return params;
	},
});
</code></pre>
]]></description><link>https://forum.magicmirror.builders/topic/12977/error-on-loading-script-new-module-not-working</link><generator>RSS for Node</generator><lastBuildDate>Thu, 21 May 2026 05:02:12 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/12977.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 02 Jun 2020 10:47:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Error on loading script (new module not working) on Wed, 03 Jun 2020 10:47:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> Thank you! That one is edited for the forum actually, but anyway, you solved my problem ;)</p>
]]></description><link>https://forum.magicmirror.builders/post/76422</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/76422</guid><dc:creator><![CDATA[Bobae]]></dc:creator><pubDate>Wed, 03 Jun 2020 10:47:06 GMT</pubDate></item><item><title><![CDATA[Reply to Error on loading script (new module not working) on Tue, 02 Jun 2020 11:51:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bobae" aria-label="Profile: Bobae">@<bdi>Bobae</bdi></a> the name of the file you showed, we call it the modulename.js as the name MUST match the name of the module. which also must match the  name of the folder the module is in</p>
<p dir="auto">and in config.js the name is the name of the folder</p>
<pre><code>{ 
  module: 'name_of_module_folder',
  position: 'some screen position',
  config: {
  }
}
</code></pre>
<p dir="auto">i hope this is  edited for the forum</p>
<pre><code>http://localhost:8080/modules/{mymodule}
</code></pre>
<p dir="auto">it just says that the name of the module in config.js doesn’t match the name of the folder</p>
]]></description><link>https://forum.magicmirror.builders/post/76374</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/76374</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Tue, 02 Jun 2020 11:51:07 GMT</pubDate></item></channel></rss>