Automattic / studio

Studio by WordPress.com, a free desktop app that helps developers streamline their local WordPress development workflow.
https://developer.wordpress.com/studio/
GNU General Public License v2.0
200 stars 19 forks source link

WP CLI: environment variables not set #359

Open fbertram opened 4 months ago

fbertram commented 4 months ago

Quick summary

I want to use WP CLI on Windows. When I open a shell by clicking Studio's 'Terminal' button, the environment variables needed to run WP CLI are not set correctly.

Steps to reproduce

  1. Start the Studio App on Windows
  2. Start an existing WordPress project
  3. Click on the 'Open in Terminal' button to open a shell
  4. enter a command, e.g., wp user list

What you expected to happen

WP CLI should launch and execute the desired command

What actually happened

because PATH is not set correctly, the wp command is not found. Also, in order to successfully executeC:\Users\[username]\AppData\Local\studio\app-1.0.5\resources\bin\wp.bat, the variable STUDIO_APP_PATH must be set.

Impact

Some (< 50%)

Available workarounds?

Yes, easy to implement

Platform

Windows

Logs or notes

A possible workaround is to:

mrfoxtalbot commented 4 months ago

I am on Mac, I will let you triage this one, @wojtekn

peterschimke commented 1 week ago

I am a mac user as well. @wojtekn were you able to take a look at this?

wojtekn commented 1 week ago

@mrfoxtalbot @peterbutler I validated and confirmed this issue:

  1. Install PHP for Windows CLI using instructions
  2. Install WP CLI using instructions
  3. Open Terminal from Studio
  4. Run wp command
  5. See the error

Image

When I open a new terminal tab and run the wp command again, it works correctly:

Image