Answers.Body: <p>So you're accessing <code>craft.config.cache</code> but unless you've actually added your own <code>cache</code> config setting in <code>craft/config/general.php</code> that's not going to work. There's no <code>cache</code> setting in Craft's <a href="https://craftcms.com/docs/config-settings" rel="nofollow noreferrer">Config Settings</a></p>
  
  <p>So the reason it works on <code>live</code> production is it's a soft error, and you have <code>devMode</code> off, so it continues to work. In <code>local</code> dev, presumably you have <code>devMode</code> on, so it rightly errors.</p>
  
  <p>For more information on Craft cache tags, you can read the <a href="https://nystudio107.com/blog/the-craft-cache-tag-in-depth" rel="nofollow noreferrer">The Craft {% cache %} Tag In-Depth</a> article.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-22T04:00:56.450Z
Answers.LastActivityDate: 2017-11-22T04:00:56.450Z
Answers.UserDisplayName: andrew.welch
Answers.Body: <p>Have you tried to activate development mode under <code>craft/config/general.php</code>?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-23T21:32:41.320Z
Answers.LastActivityDate: 2017-08-23T21:32:41.320Z
Answers.UserDisplayName: Jefry Dewangga
Body: <p>I'm having an issue where I am getting template errors related to my craft cache tags in some environments but not others. I have my site set up on a production server that is a Linode/Forge setup. The site works fine there.</p>
  
  <p>Locally I am using a Homestead/Vagrant setup and I am getting template errors on any pages that use the cache tag.</p>
  
  <p>Here's the code that is having the error:</p>
  
  <pre><code>{% extends "_layout" %}
  
  
  {% block pageStyles %}
  
  {% for entry in craft.entries.section('juices') %}
      .color-nameplate.btn-{{entry.slug}} {
          background-color: {{entry.productColorCode}};
      }
  {% endfor %}
  
  {% endblock %}
  
  {% block bodyClass %}home-page{% endblock %}
  
  
  {% block content %}
  
  {% cache if craft.config.cache %}
  
  {% for row in entry.bodyBuilder.level(1) %}
      {% include 'bodyblocks/' ~ row.type.handle with {row: row} %}
  {% endfor %}
  
  {% endcache %}
  
  {% endblock %}
  </code></pre>
  
  <p>This code works in the production environment but not on local. On local it is showing the following template error:</p>
  
  <blockquote>
    <p>Unexpected token "name" of value "craft" ("end of statement block" expected).</p>
  </blockquote>
  
  <p>If I remove the cache tags then the template displays, but this won't work for my production environment so I need to work out what the issue is. </p>
  
  <p>Thanks,</p>
  
  <p>Brian</p>
  
Tags: <cache>
Title: Getting Template Errors When Using Cache Tag in some environments but not in others
ThreadText: # Getting Template Errors When Using Cache Tag in some environments but not in others
  
  (Asked by: username_0 on 2017-08-17)
  
  I'm having an issue where I am getting template errors related to my craft cache tags in some environments but not others. I have my site set up on a production server that is a Linode/Forge setup. The site works fine there.
  
  Locally I am using a Homestead/Vagrant setup and I am getting template errors on any pages that use the cache tag.
  
  Here's the code that is having the error:
  
  ```
  {% extends "_layout" %}
  
  {% block pageStyles %}
  
  {% for entry in craft.entries.section('juices') %}
      .color-nameplate.btn-{{entry.slug}} {
          background-color: {{entry.productColorCode}};
      }
  {% endfor %}
  
  {% endblock %}
  
  {% block bodyClass %}home-page{% endblock %}
  
  {% block content %}
  
  {% cache if craft.config.cache %}
  
  {% for row in entry.bodyBuilder.level(1) %}
      {% include 'bodyblocks/' ~ row.type.handle with {row: row} %}
  {% endfor %}
  
  {% endcache %}
  
  {% endblock %}
  
  ```
  
  This code works in the production environment but not on local. On local it is showing the following template error:
  
  > Unexpected token "name" of value "craft" ("end of statement block" expected).
  
  If I remove the cache tags then the template displays, but this won't work for my production environment so I need to work out what the issue is.
  
  Thanks,
  
  username_0
  
  **Tags:** cache
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-11-22. Score: 2
  
  So you're accessing `craft.config.cache` but unless you've actually added your own `cache` config setting in `craft/config/general.php` that's not going to work. There's no `cache` setting in Craft's [Config Settings](https://craftcms.com/docs/config-settings)
  
  So the reason it works on `live` production is it's a soft error, and you have `devMode` off, so it continues to work. In `local` dev, presumably you have `devMode` on, so it rightly errors.
  
  For more information on Craft cache tags, you can read the [The Craft {% cache %} Tag In-Depth](https://nystudio107.com/blog/the-craft-cache-tag-in-depth) article.
  
  
  ---
  
  ### Answer by username_2 on 2017-08-23. Score: 0
  
  Have you tried to activate development mode under `craft/config/general.php`?
  
  
  ---
  
  