Roots Error #4 – composer create-project roots/sage mysite 8.5.3 zsh: command not found: composer

This year we began using Roots’ Trellis, Bedrock and Sage to develop and manage websites.

So far, I’ve only successfully completed one. But I’m actively working on three others. All riddled with obnoxious problems that seem to appear out of nowhere.

Luckily for me, I have four computers. Two Macs, one Windows and one Linux Ubuntu.

So when I get stuck on one of these computers I sometimes log onto the other and run the exact same commands there and either get new errors or work it out.

 

The Problem

Today, I’m using the iMac with MacOS Sierra 10.12.6 and while attempting to install the Sage Theme into my Trellis + Bedrock stack I discovered I did not have Composer installed.

Now, I have installed it in the past, and probably uninstalled it because I encountered some previous error that lead me to think starting over would be easier than debugging.

So I followed the official instructions to install Composer, and when I run php composer.phar I get the list of commands you can run with Composer, which means it’s working.

So I exit Terminal completely and navigate to my site/web/app/themes/ folder and run composer create-project roots/sage my-site 8.5.3 but I get an error:

zsh: command not found: composer

The only reason I can think this is happening is because ZSH must be looking in the wrong location for composer. But that doesn’t really make sense because if that was the case I should have gotten the same error when I ran php composer.phar from ~/ earlier. At least by my logic. So it has to be something else.

 

The Solution

After doing some more research, I stumbled across this post which indicated the location that Composer was installed has to be modified from it’s default install location. I first did this on my other Mac, and my Linux Ubuntu machine and don’t recall being required to take this step. Nor is it mentioned in the Roots docs. But upon relocating it to my global directory instead of my user directory I was able to rerun the original command in my Themes directory and it worked.

mv composer.phar /usr/local/bin/composer

Thencd ~/mysite.com/site/web/app/themes/ && composer create-project roots/sage my-site (this time I left off the version number because it automatically downloads the latest version anyway. It’s possible that that specify the version number so you can lock it in that way so it doesn’t accidentally update if you run a composer update but I don’t update sites often at this point so that doesn’t matter to me.

 

Obviously, this is not an error with Roots, Trellis, Bedrock or Sage themselves. But I attribute it as a failure of the documentation there to specify this. I will propose to the community a patch on this. But so far most of the contributions I’ve made they reject because they seem to feel my issues are so acute that no one will ever experience them. Considering I manage about 12 developers who all ask the same questions I have to disagree. But, once again, I’m not in charge of their forums but at least I can post it here to help those who do experience the issue.




By:
Spencer Hill
Categorized in: Bedrock, Linux, Mac, Roots, Sage Theme, Trellis, Ubuntu
This post is related to:

About

Since 2005 we've been offering digital and content marketing strategy and implementation. Including website development, search engine optimization and marketing, search marketing and more.

Continue Reading »

Contact

Email

us@theportlandcompany.com

Phone

503-567-9561

Follow

  • Logo for The Portland Company with a Coyote
    Thank you for using our site. x