Closed webrgp closed 1 year ago
Please add the versions of Craft CMS, and the plugins in question
I've added my composer.json
to the issue.
From the Typogriphy issue
This only happens when running the command the first time, on a freshly installed craft site:
ddev composer create -y --no-scripts craftcms/craft
ddev craft install/craft
ddev composer require --no-progress --no-scripts --no-interaction --optimize-autoloader --ignore-platform-reqs --with-all-dependencies craftcms/mailgun craftcms/redactor mmikkel/retcon nystudio107/craft-closure nystudio107/craft-retour nystudio107/craft-seomatic nystudio107/craft-typogrify nystudio107/craft-vite ostark/craft-relax putyourlightson/craft-blitz-recommendations sebastianlenz/linkfield spacecatninja/imager-x vaersaagod/dospaces verbb/formie verbb/navigation verbb/smith verbb/super-table
ddev craft plugin/install --all
I only caught this because I use a Makefile to install a fresh copy of craft and those plugins and I notice this error only occurs AFTER I first run "composer require" to add the plugins. After running the ddev craft plugin/install --all
the first time, I can run ddev craft plugin/uninstall --all
and ddev craft plugin/install --all
many times without an issue.
Addressed in: https://github.com/nystudio107/craft-seomatic/commit/63897ade501f9cf3175eed57a6fb91940fd32a38 & https://github.com/nystudio107/craft-seomatic/commit/e9ebee9b3aa23657d52ec8caadb1868685a89e5a
Craft CMS 3:
You can try it now by setting your semver in your composer.json
to look like this:
"nystudio107/craft-seomatic": "dev-develop as 3.4.53”,
Then do a composer clear-cache && composer update
…..
Craft CMS 4:
You can try it now by setting your semver in your composer.json
to look like this:
"nystudio107/craft-seomatic": "dev-develop-v4 as 4.0.24”,
Then do a composer clear-cache && composer update
Tried your fix but I still run into the same errors.
I did test this... are you sure that you installed the updated version as per above?
Yes I am sure.
I am about to finish the starter where the error manifests and I put the link here, you can clone it and run it and you can see it too.
Can you show me the nystudio107/craft-seomatic
entry in your composer.json
and the resulting composer.lock
files?
This is all relevant seom
on composer.lock
{
"name": "nystudio107/craft-seomatic",
"version": "dev-develop-v4",
"source": {
"type": "git",
"url": "https://github.com/nystudio107/craft-seomatic.git",
"reference": "ee90c1c4a19c74385a9981554c4f6b2e7e6ad53b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nystudio107/craft-seomatic/zipball/ee90c1c4a19c74385a9981554c4f6b2e7e6ad53b",
"reference": "ee90c1c4a19c74385a9981554c4f6b2e7e6ad53b",
"shasum": ""
},
"require": {
"craftcms/cms": "^4.0.0",
"davechild/textstatistics": "^1.0.3",
"nystudio107/craft-code-editor": "^1.0.0",
"nystudio107/craft-plugin-vite": "^4.0.7",
"php": "^8.0.2",
"php-science/textrank": "^1.0.3",
"sunra/php-simple-html-dom-parser": "^1.5.2"
},
"require-dev": {
"codeception/codeception": "^4.1.29",
"codeception/module-asserts": "^1.3.1",
"codeception/module-datafactory": "^1.1.0",
"codeception/module-phpbrowser": "^1.0.2",
"codeception/module-rest": "^1.4.2",
"codeception/module-yii2": "^1.1.5",
"vlucas/phpdotenv": "^3.0"
},
"default-branch": true,
"type": "craft-plugin",
"extra": {
"class": "nystudio107\\seomatic\\Seomatic",
"handle": "seomatic",
"name": "SEOmatic"
},
"autoload": {
"psr-4": {
"nystudio107\\seomatic\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"proprietary"
],
"authors": [
{
"name": "nystudio107",
"homepage": "https://nystudio107.com"
}
],
"description": "SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 4. It is a turnkey SEO system that is comprehensive, powerful, and flexible.",
"keywords": [
"Craft",
"JSON-LD",
"Sitemap",
"cms",
"craft-plugin",
"craftcms",
"facebook",
"meta",
"seo",
"seomatic",
"tags",
"twitter"
],
"support": {
"docs": "https://nystudio107.com/docs/seomatic/",
"issues": "https://nystudio107.com/plugins/seomatic/support",
"source": "https://github.com/nystudio107/craft-seomatic"
},
"funding": [
{
"url": "https://github.com/khalwat",
"type": "github"
}
],
"time": "2023-04-26T02:50:06+00:00"
}
And this:
{
"aliases": [
{
"package": "nystudio107/craft-seomatic",
"version": "dev-develop-v4",
"alias": "4.0.24",
"alias_normalized": "4.0.24.0"
}
],
"minimum-stability": "stable",
"stability-flags": {
"nystudio107/craft-minify": 10,
"nystudio107/craft-seomatic": 20
},
}
This is the composer.json
:
{
"require": {
"craftcms/cms": "^4.4.0",
"craftcms/mailgun": "^3.0",
"craftcms/redactor": "^3.0",
"mmikkel/retcon": "^2.6",
"nystudio107/craft-closure": "^1.0",
"nystudio107/craft-minify": "4.0.0-beta.2",
"nystudio107/craft-retour": "^4.1",
"nystudio107/craft-seomatic": "dev-develop-v4 as 4.0.24",
"nystudio107/craft-typogrify": "^4.0",
"nystudio107/craft-vite": "^4.0",
"ostark/craft-relax": "^2.0",
"putyourlightson/craft-blitz-recommendations": "^2.1",
"putyourlightson/craft-sprig": "^2.6",
"sebastianlenz/linkfield": "^2.1",
"spacecatninja/imager-x": "^4.1",
"vaersaagod/dospaces": "^2.0",
"verbb/formie": "2.0.27.1",
"verbb/navigation": "^2.0",
"verbb/smith": "^2.0",
"verbb/super-table": "3.0.8.1",
"vlucas/phpdotenv": "^5.4.0"
},
"require-dev": {
"craftcms/generator": "^1.3.0",
"yiisoft/yii2-shell": "^2.0.3"
},
"autoload": {
"psr-4": {
"modules\\": "modules/"
}
},
"config": {
"allow-plugins": {
"craftcms/plugin-installer": true,
"yiisoft/yii2-composer": true,
"treeware/plant": false
},
"sort-packages": true,
"optimize-autoloader": true,
"platform": {
"php": "8.0.2"
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example.dev', '.env');\""
]
}
}
Let me know when you have a link to your starter repo so I can use that to test.
Addressed in: https://github.com/nystudio107/craft-seomatic/commit/a55e0b178143cc37efe81e5e7e4d866422cc7afe & https://github.com/nystudio107/craft-seomatic/commit/9f433ebe3d085f7e149062b66a3f7d152f94ebec
Craft CMS 3:
You can try it now by setting your semver in your composer.json
to look like this:
"nystudio107/craft-seomatic": "dev-develop as 3.4.54”,
Then do a composer clear-cache && composer update
…..
Craft CMS 4:
You can try it now by setting your semver in your composer.json
to look like this:
"nystudio107/craft-seomatic": "dev-develop-v4 as 4.0.25”,
Then do a composer clear-cache && composer update
I know it's not listed in the composer.json
you've provided, but do you happen to have nystudio107/craft-autocomplete
installed?
No.
Okay so I replicated this locally (thank you, Spin Up Craft), this is the backtrace:
#0 [internal function]: yii\base\ErrorHandler->handleError(256, 'Ooops!', '/var/www/projec...', 245)
#1 /var/www/project/vendor/nystudio107/craft-seomatic/src/helpers/MetaValue.php(245): trigger_error('Ooops!', 256)
#2 /var/www/project/vendor/nystudio107/craft-seomatic/src/helpers/MetaValue.php(104): nystudio107\seomatic\helpers\MetaValue::parseMetaString('{{ "prime" }}', true, true)
#3 /var/www/project/vendor/nystudio107/craft-seomatic/src/models/MetaBundle.php(191): nystudio107\seomatic\helpers\MetaValue::parseString('{{ "prime" }}')
#4 /var/www/project/vendor/nystudio107/craft-seomatic/src/models/MetaBundle.php(144): nystudio107\seomatic\models\MetaBundle->normalizeMetaBundleData(true)
#5 /var/www/project/vendor/nystudio107/craft-seomatic/src/services/MetaBundles.php(245): nystudio107\seomatic\models\MetaBundle::create(Array)
#6 /var/www/project/vendor/nystudio107/craft-seomatic/src/services/MetaBundles.php(1019): nystudio107\seomatic\services\MetaBundles->createGlobalMetaBundleForSite(1)
#7 /var/www/project/vendor/nystudio107/craft-seomatic/src/migrations/Install.php(191): nystudio107\seomatic\services\MetaBundles->createGlobalMetaBundles()
#8 /var/www/project/vendor/nystudio107/craft-seomatic/src/migrations/Install.php(49): nystudio107\seomatic\migrations\Install->insertDefaultData()
#9 /var/www/project/vendor/craftcms/cms/src/db/Migration.php(49): nystudio107\seomatic\migrations\Install->safeUp()
#10 /var/www/project/vendor/craftcms/cms/src/db/MigrationManager.php(233): craft\db\Migration->up(true)
#11 /var/www/project/vendor/craftcms/cms/src/base/Plugin.php(144): craft\db\MigrationManager->migrateUp(Object(nystudio107\seomatic\migrations\Install))
#12 /var/www/project/vendor/craftcms/cms/src/services/Plugins.php(533): craft\base\Plugin->install()
#13 /var/www/project/vendor/craftcms/cms/src/console/controllers/PluginController.php(281): craft\services\Plugins->installPlugin('seomatic')
#14 /var/www/project/vendor/craftcms/cms/src/console/controllers/PluginController.php(140): craft\console\controllers\PluginController->_installPluginByHandle('seomatic')
#15 [internal function]: craft\console\controllers\PluginController->actionInstall('seomatic')
#16 /var/www/project/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#17 /var/www/project/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#18 /var/www/project/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('install', Array)
#19 /var/www/project/vendor/craftcms/cms/src/console/ControllerTrait.php(87): yii\console\Controller->runAction('install', Array)
#20 /var/www/project/vendor/craftcms/cms/src/console/Controller.php(217): craft\console\Controller->traitRunAction('install', Array)
#21 /var/www/project/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction('install', Array)
#22 /var/www/project/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('plugin/install', Array)
#23 /var/www/project/vendor/craftcms/cms/src/console/Application.php(90): yii\console\Application->runAction('plugin/install', Array)
#24 /var/www/project/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('plugin/install', Array)
#25 /var/www/project/vendor/craftcms/cms/src/console/Application.php(121): yii\console\Application->handleRequest(Object(craft\console\Request))
#26 /var/www/project/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))
#27 /var/www/project/craft(13): yii\base\Application->run()
#28 {main}
So what happens is with php craft plugin/install --all
it installs each plugin one by one, and in SEOmatic's case the install migration calls insertDefaultData()
which calls createGlobalMetaBundles()
, and in the MetaBundle method normalizeData()
which uses Twig to render some data.
This causes Twig to be instantiated, which then causes any future plugins to be unable to register their own Twig extensions.
This only happens if php craft plugin/install --all
is used; normal plugin installation via the GUI or CLI works fine.
Filed an issue here as well; we'll see what the powers that be say: https://github.com/craftcms/cms/issues/13208
This was address in Craft CMS https://github.com/craftcms/cms/issues/13208
The says that your are "The Man" is an understatement. Thank you Andrew!
Describe the bug
Issue discovered on Typogrify.
SEOmatic is causing other twig related plugins to fail install when using craft's cli command
craft plugin/install --all
, with error:I've notice this error happens with Typography and Sprig so far. Once I remove SEOmatic, they install without issues.
Check https://github.com/nystudio107/craft-typogrify/issues/82 for reference.
Versions
Here is my
composer.json