2

I recently installed WP-CLI on windows with the instructions below. However when I type wp shell I get en error: The system cannot find the path specified.

One solution on github says:

Psysh is not bundled in wp-cli.phar, but you should be able to include it, like so:

wget psysh.org/psysh -O psysh.phar
php wp-cli.phar --require=psysh.phar shell`

However, that also produces an error: 'wget' is not recognized as an internal or external command, operable program or batch file.

Please help! I'm too far down the rabbit hole. I wanted to use WP CLI to make my life easier!

Installation instructions followed (from http://wp-cli.org/docs/installing/):

Installing on Windows# Install via composer as described above or use the following method.

Make sure you have php installed and in your path so you can execute it globally.

Download wp-cli.phar manually and save it to a folder, for example c:\wp-cli

Create a file named wp.bat in c:\wp-cli with the following contents:

@ECHO OFF php "c:/wp-cli/wp-cli.phar" %* Add c:\wp-cli to your path:

setx path "%path%;c:\wp-cli" You can now use WP-CLI from anywhere in Windows command line.

8
  • 2
    hmmm, sounds like the best place to ask it is on github? (if it will make you feel better I also failed to install it on windows some time ago, just decided I can live without it for what I needed) Commented Oct 26, 2016 at 9:48
  • 1
    I understand your reluctance to engage in debate over reasons. However, from my hilltop, with my level of experience, the question seems to be about WordPress development. I want to use the WP CLI, which is a WP development tool, and it doesn't work as expected (no shell). The fact that the solution may involve details specific to Windows doesn't make the question irrelevant here, IMO. I was going to post in Stack Overflow, but was trying to be considerate by using what I thought was the correct forum. Commented Oct 27, 2016 at 7:39
  • 2
    For the record while WP CLI is not explicitly on topic, we tend to allow questions about it because of it's unique role as related to WP project and infrastructure.
    – Rarst
    Commented Oct 29, 2016 at 13:49
  • 2
    wget is a linux command to download a file, downloading psysh.org/psysh and naming the resulting file psysh.phar will have the same effect
    – Tom J Nowell
    Commented Oct 29, 2016 at 13:52
  • 1
    Your problem is not WP CLI, but that wget is not installed. As wget might not be available (a) per default in your OS (b) is not in your $PATH (c) not available in your shell, this question really is off topic. Searching just for the plain error on Google for StackOverflow gave me this answer as first result, which explains the details. While I agree that the "tutorial" on wp-cli.org is not perfect, the question at its current point is off topic.
    – kaiser
    Commented Oct 29, 2016 at 22:58

2 Answers 2

3

OK, I've now solved this.

Here's what I did.

When I tried to use Composer to install psy/psysh using composer, there was a clash of versions of symphony due to some work I'd done with Laravel. I decided to completely re-install Composer using the Windows installer, since I didn't really understand what was going on. (First I had to delete it - instructions here: https://stackoverflow.com/questions/30396451/remove-composer).

Once composer was installed, I used just two commands to make everything work perfectly:

composer global require wp-cli/wp-cli

composer global require psy/psysh

Now, when I type wp shell in the command line, it's good to go. Yay!

0

I didn't like the idea of having to install a global dependency to composer for just one library. While this worked fine, it felt a little too much like an anti-pattern to me.

Instead I forked wp-cli to create a version that has the requirement built in so it will work on Windows using a standard wp-cli.phar

Download the latest -windows version here

At the time of writing, the forked version is 1.4.0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.