13 Things To Check When Your Code Isn't Running
Tags: programming, productivity
Published: 2021-06-14 18:41:13

---
title: 13 Things To Check When Your Code Isn't Running
published: true
description: Sometimes code doesn't run as expected, and sometimes it doesn't make sense to us why. Here are a list of things to check the next time you feel like you're going insane.
tags: programming, productivity
//cover_image: https://direct_url_to_image.jpg
---

{% twitter 1404498365539393538 %}

We've all been there. Some of us live there. You made code changes, and they aren't appearing in the compiled code, the locally-running web environment, or somewhere else you expect them to appear. I'll be using this list to save myself time in the future, and will be adding to it. Leave a comment with your own "Thing to Check" and I might add it!

# Do you need to blow away a build folder?
I recently ran into an issue where a Typescript-compiled `./built` folder used to generate a production build wasn't deleting old/renamed files (in the case of a folder restructure or renaming). So what ended up happening was, `./stores/SomeStore.js` and `./stores/SomeStore/index.js` were both files that existed in _the build folder_, but not my project. I'd make changes to `./stores/SomeStore/index.ts` but when I built for production, the application was still being built with `./stores/SomeStore.js`, and none of my code changes showed up in the application until I deleted `.built` and added a deletion step to my build process.

# Did you make changes in a build folder?
Build folders often hold compiled versions of source folder code. If you're searching for code in your project and haven't excluded build folders from search, you can easily make the mistake of editing code that will just be overwritten by the source code when you build.

# Are you "host filed"?
Are you thinking you're on a live version of an app because the URL shows that? But really you've host-filed yourself and you're proxying your local? Maybe it's time to `vi /etc/hosts` and check.

# Environment variables obscuring debugging or removing your change?
Maybe you can't see your code change because logging is turned off in certain builds, or something.

{% twitter 1322999774027653125 %}

# Do you have multiple tabs/windows of the same App open, in different environments?
Have you ever refreshed, over and over, the *staging* version of an app, when what you meant to check was your *local*?

{% twitter 1285301288012582921 %}

# Are you in the right terminal window/folder?
Some code needs to be run at a particular path, or from a terminal that has access and permissions to certain tools. Sometimes you have to `touch` a certain file to trigger a change, or you might have to spin up a new terminal.

# Is there a delay in the view?
Does the code take a while to build after every change? Are you using a viewer that doesn't refresh the data source?
{% twitter 1404493209691111425 %}

# Did you save the file before building?
I can't tell you how many times I've rebuilt a project looking for an expected code change before noticing I haven't even saved the file I changed.
{% twitter 1308472663531192320 %}

# Making changes in the right branch? In the right file? In the right folder?
Maybe you've made a change in a feature branch but built the develop branch. Maybe you're working on a file with the right name, but you're in the wrong directory/at the wrong route. Maybe you're literally looking at the wrong file.
{% twitter 1308488702075654144 %}

# Does your code change require other database or authentication changes?
{% twitter 1339958678259167233 %}

# Did you misspell something?
{% twitter 1321854616624111616 %}
{% twitter 1252821204118851588 %}

# Did you push your code?
{% twitter 1156678847972163584 %}

# Are you checking build output but assuming build succeeded?
Maybe the build failed and you're still looking at the old application. It's happened to me.

If one of these ended up getting you unstuck, or you have your own Thing to Check, leave it below!


----

I'm Adam, a web developer, self-published fiction author, and a sometimes somewhat humorous public speaker. I'm new to Dev, and you can follow me [here](https://dev.to/adamholwerda) or on Twitter [@adamholwerda](https://twitter.com/adamholwerda). I look forward to hearing from you!