Please create a thread on the help forum with as much information as you can, including: Any logs if relevant, narrat version, browser used, description of the issue, and what you’ve attempted. You can also ask for help on Discord if it’s a small thing, but the forum is preferred as it’s easier to keep track of issues and other people who have the same issue will be able to find that thread in the future.
Most errors on startup come from the script compiler, which usually means there is a syntax error in your script. The error box will usually tell you what the error is, but sometimes unexpected errors can happen which don’t have a helpful error message. This is where more advanced troubleshooting is needed.
If you right click on the page and click “inspect” (on Chrome or Firefox), it will open the dev console. The usual shortcut for that is ctrl+shift+J.
Near the top of the logs in the browser console should be a log indicating which specific version of narrat is running and when it was built.
Make sure this is the version you’re expecting, and if you ask for help please include this information.
Sometimes errors can be caused by a file not loading (a typo in a path for example). Looking in the network tab of the dev tools (you might have to click reload) can help see if any assets are failing to load.
If you get errors in the actual terminal when building the game, it means something is wrong with your local setup. Possible options:
- Have you run
- Try deleting the
node_modulesfolder and running
npm installagain (this is where all the dependencies are installed).
npmwarning about security can be ignored (see below)
Those errors happen when running the actual game and will appear directly in the game’s screen, or sometimes only in the browser console
If you see an error when booting the game, it likely means your narrat script files couldn’t compile properly or your config has issues. The error message should help figure out which file is wrong. If not, you’ll need to ask for help.
If your error happens while playing through the game, then it’s a runtime error where something went wrong. It can be an issue in your scripts that broke the game, or potentially a bug in the engine. Again, look for any helpful logs, and if lost, ask for help.
This type of error means that a value in your config is invalid. The error message should tell you which part of the config is invalid. You just need to fix the config to match the correct format. If unsure, ask for help and include your config
This type of error means that there is a syntax error in your script. The error message should tell you which narrat file and specific line is wrong. Sometimes the error may not be on the exact same line as it can be caused by a mistake higher up in the file, but it should give you a general idea.
A common reason for script mistakes is having an incorrect level of identation somewhere. Another one (as in this screenshot), is using a command with the wrong type or amounts of parameters.
The most common cause for this is having paths in the CSS that don’t start with
/. For example it should be
background-image: url("/img/image.png") and not
You can’t open the
index.html file created by a build directly, it needs to be hosted on a server. This is because the game loads various files (images and narrat scripts for example), and browser security policies don’t allow web pages to load files directly from your hard drive. You can use a local server to host the game, or upload it to a web server (for example it will work when releasing a game to itch.io).
If you want an easy way to launch a local web server to test your built html game, simply go in the
dist folder where your built game is in the terminal, and run the command
npx http-server. This will install and run a lightweight server that lets you access your game.
Most likely issue is that you’re trying to use operators like in most common programming languages (for example
if (something && somethingElse)). But the in the narrat scripting language everything is a command, including operators. This means that the previous example should actually be
if (&& something somethingElse). Or for example
set data.sum (+ 1 (* 2 2)) which in this case would result in 5 (1 + 2 * 2). Support for operators syntax might be added in the future, but for now you have to use the command syntax as the scripting language is similar to a lisp language.
Remember that the game needs to be built before running on electron by running
npm run build. The
npm run electron command only starts electron, but doesn’t build your game.
You can use
npm run desktop as a shortcut command to first build your game and then open electron.
The following errors can be safely ignored and aren’t relevant
Those XML parsnig errors on narrat files can be ignored. For some reason, Firefox is trying to parse narrat files as an XML file. It doesn’t do anything.
Security warnings from npm when installing a game can be ignored. They come from the npm audit system, which is a very flawed system that flags development tools as being exploitable, even though they’re never exposed to users, making those errors irrelevant to their actual use case. More background info on this here.