Troubleshooting Theme Kit

This reference guide contains troubleshooting information to help you resolve common issues in Theme Kit.

Update Theme Kit

Before you run any Theme Kit commands, make sure you're using the latest version of Theme Kit. You should also uninstall the shopify-theme gem, if you have used it previously.

You can uninstall existing instances of the shopify-theme gem with the following command:

Terminal
$ gem uninstall shopify-theme

To update Theme Kit to the latest version, run the following command:

Terminal
$ theme update --version=[version number]

For example, if you want to update Theme Kit to version 1.1.1, then you can run the following command:

Terminal
$ theme update --version=v1.1.1

To test that Theme Kit is installed and working, run the following command:

Terminal
$ theme --help

Reload a page

To reload a page when you make changes to Theme Kit, you need to use another tool. There are many options available, including the following:

Notifying about changes

To provide Theme Kit with a file to update whenever you make a change, run the following command:

Terminal
$ theme watch --notify=/var/tmp/theme_ready

If this file doesn't exist, then Theme Kit will create it when the first change happens. Then, on subsequent events, the file will be updated.

The file is updated only after the request to Shopify has been completed, and not after saving the file. You can then provide the file path to your reloading program to trigger your browser refresh.

Common errors

The following section provides some solutions to common errors that you might experience in Theme Kit.

Problems uploading changes

If you're having trouble uploading changes to Theme Kit, then check if your file is being ignored. Your file might be matching one of the ignore patterns that you previously specified.

Error: ‘TLS handshake timeout’

This error has to do with a file descriptor limit, typically due to using Theme Kit for a long time. You can usually fix this by restarting your terminal. For a long-term solution, refer to the next section.

Error: ‘Could not watch directory, too many open files’

If you receive this error, then it's probably because you're using macOS. macOS has an unusually low limit on file descriptors. You need to raise this limit manually. To raise the limit, run the following commands:

Terminal
$ echo kern.maxfiles=65536 | sudo tee -a /etc/sysctl.conf
$ echo kern.maxfilesperproc=65536 | sudo tee -a /etc/sysctl.conf
$ sudo sysctl -w kern.maxfiles=65536
$ sudo sysctl -w kern.maxfilesperproc=65536
$ ulimit -n 65536 65536

Cloud9 replaces files with other content

If you're using the Cloud9 Editor, then you can make Theme Kit work by placing all of your theme files in a folder in your workspace. After you move the files, run Theme Kit in the new folder.

For more information, refer to this issue.

Remove Theme Kit

You can remove Theme Kit by running the following command:

Terminal
$ rm $(which theme)

If you installed Theme Kit using Homebrew, then you can run:

Terminal
$ brew uninstall themekit

Next steps