Trying to find the recommend method for installing plugins via trellis, bedrock and sage.
Typically, would drag and drop a plugin into the /site/web/app/plugins/ and then enable via WP Admin. Dropped Soil plugin into that folder and the did vagrant ssh and wp plugin soil. While that’s better, I’d now like to use the proper method via composer.
Trying to find a walkthrough of every step to install a public plugin, such as jetpack.
Did vagrant ssh, then tried “composer require automattic/jetpack” which didn’t give any errors but didn’t see the plugin when logging into WordPress. Also tried opening composer.json locally and in “require”: {" I added, "“automattic/jetpack”: “3.8.1"” but then don’t see the plugin being added.
I know I’m close but trying to find the high level work flow. Such as if I should be doing composer json, then vagrant ssh enable plugin, or via composer require “plugin name” etc.
Yes, when I tried adding “automattic/jetpack”: “3.8.1” to my composer.json I had got that line from the wppackagist.org. But haven’t had luck in getting it working as still not sure on the exact process. Such as that site mentions to run “$ composer.phar update” but not sure if I should be doing that locally or first doing vagrant ssh, as well as which directory I should be doing it in for trellis/bedrock/sage.
Been trying different variations such as doing it locally and via vagrant ssh, as well as trying to run grunt after, as well as grunt watch, but I not sure if that’s necessary as it may only require composer.phar.
I’m going to keep searching though to see if I can find anyone who has written out each step for installing a standard public plugin with roots. Thanks!
When running that after doing vagrant ssh it says,
Using version ^3.8 for automattic/jetpack
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
But it doesn’t get installed in in site/web/app/plugins/
*Update - When in vagrant ssh I cd to “wp-content/plugins” and see jetpack there, but the plugin isn’t showing up locally in the “site/web/app/plugins/”. Another commenter previously had mentioned I should be running composer commands in vagrant ssh but should i be running that locally instead perhaps or a reason why the vagrant ssh plugin directory isn’t synced with the local site?
Sure. It’s the default composer.json that got created as part of installing trellis,bedrock,sage with the exception of adding that one line noted above about jetpack:
To note, the composer.json provided is the one from my local site. /site/composer.json
In vagrant, the composer.json just had:
{
"require": {
"automattic/jetpack": "^3.8"
}
}
That file is in /trellis/composer.json
Should those files automatically sync, or should I delete the composer.json in /site/ and copy and paste the contents that was in it into /trellis/composer.json? Or perhaps delete both and start fresh with composer?
I’m thinking that may be the issue, that I installed composer on the site directory rather than in trellis directory initially?
That means you ran the composer commands in the Trellis folder. You need to run it where the Bedrock installation is, and where the composer.json file is
You rock! Thank you all for the team work, very helpful.
As Kalen noted, my issue was I mistakenly also installed composer in trellis (rather than just using it in the sites folder. Actually, I should have realized that when Swalkinshaw mentioned to cd current dir.
Went ahead and deleted the composer and vendor assets from the incorrect locations and then also removed them from the current directory and started fresh installing them there again based on swalkinshaw’s previous instructions and everything is now working as expected. Yay!
Thanks again for discovering my roots newbie misstep.