laravel / jetstream

Tailwind scaffolding for the Laravel framework.

Home Page:https://jetstream.laravel.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`jetstream:install livewire` results in "Could not parse version constraint ^^3.0" on Windows 11

m-stilling opened this issue · comments

Jetstream Version

4.2.2

Jetstream Stack

Livewire

Laravel Version

10.42.0

PHP Version

8.3.2

Database Driver & Version

No response

Description

Following the installation instructions from the docs, I receive this error when running php artisan jetstream:install livewire --teams --dark:

In VersionParser.php line 521:
  Could not parse version constraint ^^3.0: Invalid version string "^^3.0"

Windows 11 and Composer 2.6.6, updated from 2.4.something when trying to solve this issue. I've also tried on PHP 8.1.27.

The only Jetstream related post I've been able to find is this post: https://laracasts.com/discuss/channels/laravel/laravel-80-and-artisan-jetstreaminstall-fails-on-windows-10, but in the end the problem seems to be related to this: composer/composer#11288

Editing the installLivewireStack() method in InstallCommand.php by adding extra carets, like the composer issue above describes, doesn't work. However, making this change works:

// Install Livewire...
- if (! $this->requireComposerPackages('livewire/livewire:^3.0')) {
+ if (! $this->requireComposerPackages('livewire/livewire:>=3.0 <4.0')) {
    return false;
}

But that doesn't really seem like a solution. I guess I'll leave it up to you guys to decide if you want to do anything with this, I think a note in the docs might be warranted, although it seems like pretty much no one uses Windows to develop a Jetstream application, being that I wasn't able to find many Jetstream-specific issues 😅

I just made the change above to get the command to run, and switched back to a caret in the composer.json afterwards.

Steps To Reproduce

composer create-project laravel/laravel example-app

cd example-app

composer require laravel/jetstream

php artisan jetstream:install livewire --teams --dark

Honestly, this is a Powershell specific issue. Most of development on Windows with Laravel happens through WSL2. For Powershell it's there are weird quirks that don't work all the time unfortunately like this one. Also see this related issue: composer/composer#10943.

Right now, I can only recommend that if you work with Laravel on Windows to use WSL2 and not Powershell directly. Sorry if that's not too helpful.