TransWikia.com

Issue on new craft (craftcms3) setups: vendor Twig can't read system variable

Craft CMS Asked by Recipe on May 31, 2021

After installing craft through composer, setting up the database and running craft setup, I have a craft application ready to go.

When I go to settings/general, I always get a crash with following information:

1. in /vendor/craftcms/cms/src/templates/settings/general/_index.html at line 30
    {{ actionInput('system-settings/save-general-settings') }}
    {{ redirectInput('settings') }}
 
    {{ forms.autosuggestField({
        first: true,
        label: "System Name"|t('app'),
        id: 'name',
        suggestEnvVars: true,
        name: 'name',
        value: system.name
    }) }}
 
    {{ forms.lightswitchField({
        label: "System Status"|t('app'),
        warning: (craft.app.config.general.isSystemLive is same as(true) or craft.app.config.general.isSystemLive is same as(false) ? configWarning('isSystemLive')),
        id: 'live',
        name: 'live',
        onLabel: 'Online'|t('app'),
        offLabel: 'Offline'|t('app'),
2. in /vendor/craftcms/cms/src/helpers/Template.php at line 106– twig_get_attribute(craftwebtwigEnvironment, TwigSource, null, 'name', ...)
        // Add deprecated support for the old DateTime methods
        if ($object instanceof DateTime && ($value = self::_dateTimeAttribute($object, $item, $type)) !== false) {
            return $value;
        }
 
        try {
            return twig_get_attribute($env, $source, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);
        } catch (UnknownMethodException $e) {
            // Copy twig_get_attribute()'s BadMethodCallException handling
            if ($ignoreStrictCheck || !$env->isStrictVariables()) {
                return null;
            }
            throw new RuntimeError($e->getMessage(), -1, $source);
3. in /vendor/craftcms/cms/src/templates/settings/general/_index.html at line 30– crafthelpersTemplate::attribute(craftwebtwigEnvironment, TwigSource, null, 'name', ...)
    {{ forms.autosuggestField({
        first: true,
        label: "System Name"|t('app'),
        id: 'name',
        suggestEnvVars: true,
        name: 'name',
        value: system.name
    }) }}
 
    {{ forms.lightswitchField({
        label: "System Status"|t('app'),
        warning: (craft.app.config.general.isSystemLive is same as(true) or craft.app.config.general.isSystemLive is same as(false) ? configWarning('isSystemLive')),
        id: 'live',

The errors on the lines correspond to:

line 30: value: system.name

line 106: return twig_get_attribute($env, $source, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);

line 30: value: system.name

As you can see, all is happening in /vendor, so I guess it must be some setup that I have missed or incorrectly executed. Why is the system variable null? Is it because of my local machine is missing some configuration? (Macbook Pro with macOs Big Sur)

One Answer

I've looked all over for a solution to this but couldn't find anything. I don't know if you've already fixed your problem now, but in case you haven't or someone else has found this error and arrived here, a simple fix for it is to add the missing information into the project.yaml in config/project/.

For my local development build, I used the following:

system:
  edition: solo
  live: true
  name: '{YOUR PROJECT NAME HERE}'
  retryDuration: null
  schemaVersion: 3.5.13
  timeZone: UTC

For the schemaVersion, it will need to match the one specified in the installed version of Craft in your vendor folder. This can also be found in the repo.

I'm not sure what the cause of the missing info is, but I am also on a Mac running Big Sur so it may be related. Once you have added in this information, you should be able to edit it normally from Settings -> General.

Correct answer by Matt on May 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP