# Troubleshooting guide

**URL:** <https://narrat.discourse.group/t/troubleshooting-guide/33>\
**Category:** Help\
**Tags:** guide\
**Created:** [17 June 2023 12:03 UTC](https://narrat.discourse.group/t/troubleshooting-guide/33 "2023-06-17T12:03:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Narrat-Admin](https://yyz2.discourse-cdn.com/free1/user_avatar/narrat.discourse.group/narrat-admin/32/429_2.png) [@Narrat-Admin](https://narrat.discourse.group/u/Narrat-Admin)\
**Post date:** [17 June 2023 12:03 UTC](https://narrat.discourse.group/t/troubleshooting-guide/33/1 "2023-06-17T12:03:08Z")

</div>

# How to get help

Please create a thread on the [help forum](https://narrat.discourse.group/c/help/5) 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](https://discord.gg/Xgz7EQ2Xgh) 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.

# How to debug errors

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.

## Opening the browser developer tools

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.

 ![dev-console](https://global.discourse-cdn.com/free1/uploads/narrat/original/1X/a37bd2d9f66ab07065dd189302a8793cc6778a24.png)

### The console

The `console` part of the devtools is where errors will appear. It can help find hints about issues. If the errors you find are obscure javascript error and don’t help you, you can try asking for help in the narrat discord, preferably with screenshots or copy paste of all error messages you found.

## Check which version of narrat is running

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.

![version](https://global.discourse-cdn.com/free1/uploads/narrat/original/1X/1e8d5cb0791bfe12ea648c1a4eabb8e8f4a016e8.png)

### The network tab

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.

## Errors in the terminal when building the game

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 `npm install`?
- Try deleting the `node_modules` folder and running `npm install` again (this is where all the dependencies are installed).
- `npm` warning about security can be ignored (see below)

## Errors in the game itself or in the browser console

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](#how-to-get-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](#how-to-get-help).

Some examples:

### Config Error

 ![config-error](https://global.discourse-cdn.com/free1/uploads/narrat/original/1X/38b75568cafa8a4c735e362b5b717c96b7e2026a.png)

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

### Script Error

 ![script-error](https://global.discourse-cdn.com/free1/uploads/narrat/original/1X/9d90ed4ba8fcbb68478c2bb930bcb3a2ff82b835.png)

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.

### Native JavaScript error

Sometimes you might see an error in the console that refers to JavaScript code and may be harder to understand. This means that something unexpected errored in the engine and narrat doesn’t have a specific error message for it. In this case, you can try to figure out what the error message is saying, or ask for help.

## Game not launching or missing images after creating a build with electron

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 `background-image: url("img/image.png")`.

## My index.html file doesn’t work!

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](http://kb.mozillazine.org/Links_to_local_pages_do_not_work) 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](http://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.

## Using `+`, `&&` and things like that isn’t working properly

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](https://www.tutorialspoint.com/lisp/lisp_operators.htm).

## My electron build isn’t updating properly

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.

## Errors that can be ignored

The following errors can be safely ignored and aren’t relevant

### XML Parsing error in the dev console

![xml-error](https://global.discourse-cdn.com/free1/uploads/narrat/original/1X/c3ce50b786d3fb8c217c175a6eb2732b72414c9d.png)

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 on install

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](https://overreacted.io/npm-audit-broken-by-design/).

---

<div class="post-metadata">

**Author:** ![Narrat-Admin](https://yyz2.discourse-cdn.com/free1/user_avatar/narrat.discourse.group/narrat-admin/32/429_2.png) [@Narrat-Admin](https://narrat.discourse.group/u/Narrat-Admin)\
**Post date:** [17 June 2023 12:03 UTC](https://narrat.discourse.group/t/troubleshooting-guide/33/2 "2023-06-17T12:03:20Z")

</div>



---

<div class="post-metadata">

**Author:** ![Dark\_Sintera](https://yyz2.discourse-cdn.com/free1/user_avatar/narrat.discourse.group/dark_sintera/32/238_2.png) [@Dark\_Sintera](https://narrat.discourse.group/u/Dark_Sintera)\
**Post date:** [18 October 2023 21:20 UTC](https://narrat.discourse.group/t/troubleshooting-guide/33/3 "2023-10-18T21:20:19Z")

</div>

request to the developers. Add support for automatic translation from English and other languages into other languages for web versions. The inability to select text in a window with the mouse and copy-paste it into Google Translator makes games on this engine unreadable.

---

<div class="post-metadata">

**Author:** ![Narrat-Admin](https://yyz2.discourse-cdn.com/free1/user_avatar/narrat.discourse.group/narrat-admin/32/429_2.png) [@Narrat-Admin](https://narrat.discourse.group/u/Narrat-Admin)\
**Post date:** [18 October 2023 21:51 UTC](https://narrat.discourse.group/t/troubleshooting-guide/33/4 "2023-10-18T21:51:41Z")

</div>

Well, people don’t necessarily want players to be able to copy paste text, so it’s disabled by default.

But it’s just CSS, if you need to copy text you can change the css by removing the `user-select: none;` property that’s on the page, which you can do easily by opening the inspector, searching for user-select in the style rules, and removing or unticking them. After that the text is selectable.

 ![image](https://global.discourse-cdn.com/free1/uploads/narrat/original/1X/4cd767682987c7caa7c0edcd28e1e6f36b1dedd0.png)

But it’s up to people making games whether they want to release games with text selectable or not.

Also:

> [@Dark\_Sintera](#):
>
> makes games on this engine unreadable.

I don’t know many (any?) game engines that by default let people copy all text on screen.
