robsontenorio / mary

Laravel Blade UI Components for Livewire 3
https://mary-ui.com
Other
994 stars 117 forks source link

TTY mode is not supported on Windows platform #68

Closed e-smily closed 11 months ago

e-smily commented 11 months ago

Hello, I tried to install mary with: "php artisan mary:install"

I got the lollowing error: "TTY mode is not supported on Windows platform"

After all I can't get it to work even not manual .. Is there a workaround for the windows platform?

The whole Exception:

 🔨 Installing Mary...

   Symfony\Component\Process\Exception\RuntimeException

   TTY mode is not supported on Windows platform.

   at vendor\symfony\process\Process.php:1019
    1015â–•      */
     1016â–•     public function setTty(bool $tty): static
     1017â–•     {
     1018â–•         if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
   ➜ 1019▕             throw new RuntimeException('TTY mode is not supported on Windows platform.');
     1020â–•         }
     1021â–•
     1022â–•         if ($tty && !self::isTtySupported()) {
     1023â–•             throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  read/writable.');

   1   vendor\laravel\framework\src\Illuminate\Process\PendingProcess.php:316
       Symfony\Component\Process\Process::setTty()

   2   vendor\laravel\framework\src\Illuminate\Process\PendingProcess.php:246
       Illuminate\Process\PendingProcess::toSymfonyProcess("mkdir -p app/Livewire && mkdir -p resources/views/components/layouts")
robsontenorio commented 11 months ago

@e-smily

Automatic install Under the hood it uses Laravel Process https://laravel.com/docs/10.x/processes#main-content

As I don't use Windows we need help from someone who uses windows to digg how to make Laravel Process work on Windows.

Manual install You are able to do this because it is about yarn/npm/composer ordinary commands. What is the issue?

e-smily commented 11 months ago

Thanks for the answer, I got it working now with manual setup and bundling with Vite. However, I don't know exactly whether everything is there, maybe you'll find something that's missing:

composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The skeleton application for the Laravel framework.",
    "keywords": ["laravel", "framework"],
    "license": "MIT",
    "require": {
        "php": "^8.1",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^10.10",
        "laravel/sanctum": "^3.2",
        "laravel/tinker": "^2.8",
        "livewire/livewire": "^3.0",
        "robsontenorio/mary": "^0.40.0"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.18",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^7.0",
        "phpunit/phpunit": "^10.1",
        "spatie/laravel-ignition": "^2.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true,
            "php-http/discovery": true
        }
    },
    "minimum-stability": "stable",
    "prefer-stable": true
}
robsontenorio commented 11 months ago

If you can see default template with Hello everything is ok.

By the way I am reworking installer removing TTY dependency #69 , and including many requirement validations.

e-smily commented 11 months ago

I didn't have the default template because the installation didn't work, but no problem... I took the recommended layout and added a livewire component (home page).

I've tried a few things so far, such as: themes and daisy ui to use.. Everything is going very well so far, I'm pleasantly surprised at how easy the components are to integrate :)

So thank you very much for the great package and good luck in the future

robsontenorio commented 11 months ago

@e-smily If you can, please, spin up a fresh new project and try the new installer on Windows.

I just removed TTY.

image

cc @BaranSaeed @rabol

e-smily commented 11 months ago

Ok, the prompting for input looks different:

New01

I'll send you the log of the installation, there were problems creating directories:

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. Alle Rechte vorbehalten.

PS D:\laragon\www\test\livewire3\example-app> composer require robsontenorio/mary
./composer.json has been updated
Running composer update robsontenorio/mary
Loading composer repositories with package information
Updating dependencies
Lock file operations: 7 installs, 0 updates, 0 removals
  - Locking blade-ui-kit/blade-heroicons (2.1.0)
  - Locking blade-ui-kit/blade-icons (1.5.2)
  - Locking jfcherng/php-color-output (3.0.0)
  - Locking jfcherng/php-diff (6.15.3)
  - Locking jfcherng/php-mb-string (2.0.1)
  - Locking jfcherng/php-sequence-matcher (4.0.3)
  - Locking robsontenorio/mary (0.41.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 7 installs, 0 updates, 0 removals
  - Downloading robsontenorio/mary (0.41.0)
 0/1 [>---------------------------]   0%
 1/1 [============================] 100%
  - Installing blade-ui-kit/blade-icons (1.5.2): Extracting archive
  - Installing jfcherng/php-color-output (3.0.0): Extracting archive
  - Installing jfcherng/php-mb-string (2.0.1): Extracting archive
  - Installing jfcherng/php-sequence-matcher (4.0.3): Extracting archive
  - Installing jfcherng/php-diff (6.15.3): Extracting archive
  - Installing blade-ui-kit/blade-heroicons (2.1.0): Extracting archive
  - Installing robsontenorio/mary (0.41.0): Extracting archive
 0/7 [>---------------------------]   0%
 4/7 [================>-----------]  57%
 5/7 [====================>-------]  71%
 6/7 [========================>---]  85%
 7/7 [============================] 100%
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

  [37;44m INFO [39;49m Discovering packages...

89 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force

  [37;44m INFO [39;49m No publishable resources for tag [1m[laravel-assets][22m.

No security vulnerability advisories found
Using version ^0.41.0 for robsontenorio/mary
PS D:\laragon\www\test\livewire3\example-app> php artisan mary:install
?? Mary installer

It will set up:
- Livewire
- Tailwind + daisyUI
- Default layout
- Welcome component
- Route to Welcome

  Also install `livewire/volt` ?
  Yes ................................................................................................................... 0

  No .................................................................................................................... 1

? ? 0
0[K

  Install with ...
  npm ................................................................................................... npm install --dev

? ? 0
0[K

 [ERROR] Value "0" is invalid

  Install with ...
  npm ................................................................................................... npm install --dev

? ? yes
y[Ke[Ks[K

 [ERROR] Value "yes" is invalid

  Install with ...
  npm ................................................................................................... npm install --dev

? ? y
y[K

 [ERROR] Value "y" is invalid

  Install with ...
  npm ................................................................................................... npm install --dev

? ? npm
n[K7pm install --dev8p[K7m install --dev8m[K7 install --dev8 install --dev

Installing Livewire...

./composer.json has been updated
Running composer update livewire/livewire
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking livewire/livewire (v3.0.8)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing livewire/livewire (v3.0.8): Extracting archive
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

  [37;44m INFO [39;49m Discovering packages...

90 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force

  [37;44m INFO [39;49m No publishable resources for tag [1m[laravel-assets][22m.

No security vulnerability advisories found
Using version ^3.0 for livewire/livewire

Installing Livewire Volt...

./composer.json has been updated
Running composer update livewire/volt
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking livewire/volt (v1.3.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Downloading livewire/volt (v1.3.3)
  - Installing livewire/volt (v1.3.3): Extracting archive
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

  [37;44m INFO [39;49m Discovering packages...

90 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force

  [37;44m INFO [39;49m No publishable resources for tag [1m[laravel-assets][22m.

No security vulnerability advisories found
Using version ^1.3 for livewire/volt

Installing daisyUI + Tailwind...

npm WARN config dev Please use --include=dev instead.

added 109 packages, and audited 110 packages in 21s

22 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Created Tailwind CSS config file: tailwind.config.js
Created PostCSS config file: postcss.config.js
Copying stubs...

Syntaxfehler.

   Illuminate\Process\Exceptions\ProcessFailedException

  The command "mkdir -p app/Livewire && mkdir -p resources/views/components/layouts" failed.

Exit Code: 1

Error Output:
================
Syntaxfehler.

  at vendor\laravel\framework\src\Illuminate\Process\ProcessResult.php:123
    119?         if ($this->successful()) {
    120?             return $this;
    121?         }
    122?
  ? 123?         $exception = new ProcessFailedException($this);
    124?
    125?         if ($callback) {
    126?             $callback($this, $exception);
    127?         }
  127?         }

  1   vendor\robsontenorio\mary\src\Console\Commands\MaryInstallCommand.php:143
      Illuminate\Process\ProcessResult::throw()

  2   vendor\robsontenorio\mary\src\Console\Commands\MaryInstallCommand.php:87
      Mary\Console\Commands\MaryInstallCommand::copyStubs()

PS D:\laragon\www\test\livewire3\example-app>
robsontenorio commented 11 months ago

Laravel Process and Prompts are fully compatible only with Windows WSL.

https://laravel.com/docs/10.x/prompts#fallbacks