TiagoSilvaPereira / vemto2-issues

Repository to track Vemto 2 Issues
5 stars 0 forks source link

(error) FAILED to execute command: "/usr/bin/php8.2" artisan jetstream:install livewire --no-interaction #102

Closed argelium closed 3 months ago

argelium commented 4 months ago

Error Message: (error) FAILED to execute command: "/usr/bin/php8.2" artisan jetstream:install livewire --no-interaction

Stack:

Error: Command failed: "/usr/bin/php8.2" artisan jetstream:install livewire --no-interaction

    at ChildProcess.exithandler (node:child_process:407:12)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Socket.<anonymous> (node:internal/child_process:451:11)
    at Socket.emit (node:events:527:28)
    at Pipe.<anonymous> (node:net:709:12)

Steps to reproduce

Seems related to https://github.com/TiagoSilvaPereira/vemto2-issues/issues/100


Vemto 2.0.8 linux 6.5.0-28-generic Locale: en-GB App version: 2.0.8

TiagoSilvaPereira commented 4 months ago

Hi @argelium Does this problem happens when executing artisan jetstream:install livewire --no-interaction from your command line?

argelium commented 4 months ago

Hi, it fails :

❯ artisan jetstream:install livewire --no-interaction
./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.4.11)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing livewire/livewire (v3.4.11): Extracting archive
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   INFO  Discovering packages.  

  laravel/fortify ....................................................... DONE
  laravel/jetstream ..................................................... DONE
  laravel/sail .......................................................... DONE
  laravel/tinker ........................................................ DONE
  livewire/livewire ..................................................... DONE
  nesbot/carbon ......................................................... DONE
  nunomaduro/collision .................................................. DONE
  nunomaduro/termwind ................................................... DONE
  spatie/laravel-ignition ............................................... DONE

87 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

   INFO  No publishable resources for tag [laravel-assets].  

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

   INFO  Discovering packages.  

  laravel/fortify ....................................................... DONE
  laravel/jetstream ..................................................... DONE
  laravel/sail .......................................................... DONE
  laravel/sanctum ....................................................... DONE
  laravel/tinker ........................................................ DONE
  livewire/livewire ..................................................... DONE
  nesbot/carbon ......................................................... DONE
  nunomaduro/collision .................................................. DONE
  nunomaduro/termwind ................................................... DONE
  spatie/laravel-ignition ............................................... DONE

87 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

   INFO  No publishable resources for tag [laravel-assets].  

No security vulnerability advisories found

   INFO  Published API routes file.  

   INFO  API scaffolding installed. Please add the [Laravel\Sanctum\HasApiTokens] trait to your User model.  

added 147 packages, and audited 148 packages in 22s

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

found 0 vulnerabilities

> build
> vite build

vite v5.2.10 building for production...
✓ 47 modules transformed.
public/build/manifest.json             0.27 kB │ gzip:  0.14 kB
public/build/assets/app-DUBOuVrC.css  55.48 kB │ gzip:  9.24 kB
public/build/assets/app-D2jpX1vH.js   29.83 kB │ gzip: 11.98 kB
✓ built in 1.70s

  Dropping all tables .................................................................................................................. 1.43ms DONE

   INFO  Preparing database.  

  Creating migration table ............................................................................................................ 16.34ms DONE

   INFO  Running migrations.  

  0001_01_01_000000_create_users_table ................................................................................................ 64.55ms DONE
  0001_01_01_000001_create_cache_table ................................................................................................ 19.37ms DONE
  0001_01_01_000002_create_jobs_table ................................................................................................. 86.65ms DONE
  2024_04_26_111045_add_two_factor_columns_to_users_table ............................................................................. 22.82ms DONE
  2024_04_26_111121_add_two_factor_columns_to_users_table ............................................................................. 11.96ms FAIL

   Illuminate\Database\QueryException 

  SQLSTATE[HY000]: General error: 1 duplicate column name: two_factor_secret (Connection: sqlite, SQL: alter table "users" add column "two_factor_secret" text)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:813
    809▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    810▕                 );
    811▕             }
    812▕ 
  ➜ 813▕             throw new QueryException(
    814▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    815▕             );
    816▕         }
    817▕     }

      +9 vendor frames 

  10  database/migrations/2024_04_26_111121_add_two_factor_columns_to_users_table.php:15
      Illuminate\Support\Facades\Facade::__callStatic()
      +50 vendor frames 

  61  artisan:13
      Illuminate\Foundation\Application::handleCommand()

Looks like there is a duplicated migration :

  2024_04_26_111045_add_two_factor_columns_to_users_table ............................................................................. 21.64ms DONE
  2024_04_26_111121_add_two_factor_columns_to_users_table .............................................................................. 6.86ms FAIL
cat database/migrations/2024_04_26_111045_add_two_factor_columns_to_users_table.php                                       
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Laravel\Fortify\Fortify;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->text('two_factor_secret')
                ->after('password')
                ->nullable();

            $table->text('two_factor_recovery_codes')
                ->after('two_factor_secret')
                ->nullable();

            if (Fortify::confirmsTwoFactorAuthentication()) {
                $table->timestamp('two_factor_confirmed_at')
                    ->after('two_factor_recovery_codes')
                    ->nullable();
            }
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn(array_merge([
                'two_factor_secret',
                'two_factor_recovery_codes',
            ], Fortify::confirmsTwoFactorAuthentication() ? [
                'two_factor_confirmed_at',
            ] : []));
        });
    }
};

and

cat database/migrations/2024_04_26_111121_add_two_factor_columns_to_users_table.php                                                       
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Laravel\Fortify\Fortify;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->text('two_factor_secret')
                ->after('password')
                ->nullable();

            $table->text('two_factor_recovery_codes')
                ->after('two_factor_secret')
                ->nullable();

            if (Fortify::confirmsTwoFactorAuthentication()) {
                $table->timestamp('two_factor_confirmed_at')
                    ->after('two_factor_recovery_codes')
                    ->nullable();
            }
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn(array_merge([
                'two_factor_secret',
                'two_factor_recovery_codes',
            ], Fortify::confirmsTwoFactorAuthentication() ? [
                'two_factor_confirmed_at',
            ] : []));
        });
    }
};
argelium commented 4 months ago

Same error with v 2.0.7 Works with v 2.0.6 (but there is no Filament checkbox)

TiagoSilvaPereira commented 4 months ago

Hmmm ok, it seems the Jetstream installation was run twice for this project, and this migration was duplicated. I'll check how to prevent this from happening. Does it happen only for project with Filament?

argelium commented 4 months ago

No, the error happens also if I uncheck "Install Filament".

TiagoSilvaPereira commented 4 months ago

@argelium thanks.. does it happen whenever you try to create a new project?

argelium commented 4 months ago

Yes, I tried with breeze and it's the same.

Message ID: @.*** com>

TiagoSilvaPereira commented 4 months ago

Hi @argelium could you please check if this error still happens by creating a new project from Vemto 2.0.10?

argelium commented 4 months ago

Hi @TiagoSilvaPereira, unfortunately the error still occurs :

(error) FAILED to execute command: "php" artisan jetstream:install livewire --no-interaction
Error: Command failed: "php" artisan jetstream:install livewire --no-interaction

    at ChildProcess.exithandler (node:child_process:407:12)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Socket.<anonymous> (node:internal/child_process:451:11)
    at Socket.emit (node:events:527:28)
    at Pipe.<anonymous> (node:net:709:12)
❯ php artisan jetstream:install livewire --no-interaction 
./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.4.12)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing livewire/livewire (v3.4.12): Extracting archive
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   INFO  Discovering packages.  

  laravel/fortify ....................................................... DONE
  laravel/jetstream ..................................................... DONE
  laravel/sail .......................................................... DONE
  laravel/tinker ........................................................ DONE
  livewire/livewire ..................................................... DONE
  nesbot/carbon ......................................................... DONE
  nunomaduro/collision .................................................. DONE
  nunomaduro/termwind ................................................... DONE
  spatie/laravel-ignition ............................................... DONE

87 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

   INFO  No publishable resources for tag [laravel-assets].  

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

   INFO  Discovering packages.  

  laravel/fortify ....................................................... DONE
  laravel/jetstream ..................................................... DONE
  laravel/sail .......................................................... DONE
  laravel/sanctum ....................................................... DONE
  laravel/tinker ........................................................ DONE
  livewire/livewire ..................................................... DONE
  nesbot/carbon ......................................................... DONE
  nunomaduro/collision .................................................. DONE
  nunomaduro/termwind ................................................... DONE
  spatie/laravel-ignition ............................................... DONE

87 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

   INFO  No publishable resources for tag [laravel-assets].  

No security vulnerability advisories found

   INFO  Published API routes file.  

   INFO  API scaffolding installed. Please add the [Laravel\Sanctum\HasApiTokens] trait to your User model.  

added 147 packages, and audited 148 packages in 10s

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

found 0 vulnerabilities
npm notice 
npm notice New major version of npm available! 9.8.1 -> 10.7.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.7.0
npm notice Run npm install -g npm@10.7.0 to update!
npm notice 

> build
> vite build

vite v5.2.11 building for production...
✓ 47 modules transformed.
public/build/manifest.json             0.27 kB │ gzip:  0.14 kB
public/build/assets/app-j8pi8qhU.css  55.90 kB │ gzip:  9.30 kB
public/build/assets/app-DkDdL2UM.js   29.76 kB │ gzip: 11.94 kB
✓ built in 1.79s

  Dropping all tables .................................................................................................................. 1.74ms DONE

   INFO  Preparing database.  

  Creating migration table ............................................................................................................ 12.38ms DONE

   INFO  Running migrations.  

  0001_01_01_000000_create_users_table ................................................................................................ 61.57ms DONE
  0001_01_01_000001_create_cache_table ................................................................................................ 20.33ms DONE
  0001_01_01_000002_create_jobs_table ................................................................................................. 46.46ms DONE
  2024_05_07_214346_add_two_factor_columns_to_users_table ............................................................................. 20.14ms DONE
  2024_05_07_214413_add_two_factor_columns_to_users_table .............................................................................. 6.22ms FAIL

   Illuminate\Database\QueryException 

  SQLSTATE[HY000]: General error: 1 duplicate column name: two_factor_secret (Connection: sqlite, SQL: alter table "users" add column "two_factor_secret" text)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:813
    809▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    810▕                 );
    811▕             }
    812▕ 
  ➜ 813▕             throw new QueryException(
    814▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    815▕             );
    816▕         }
    817▕     }

      +9 vendor frames 

  10  database/migrations/2024_05_07_214413_add_two_factor_columns_to_users_table.php:15
      Illuminate\Support\Facades\Facade::__callStatic()
      +50 vendor frames 

  61  artisan:13
      Illuminate\Foundation\Application::handleCommand()
TiagoSilvaPereira commented 4 months ago

@argelium could you please try creating the project from command line and see what happens? Vemto executes the following commands in sequence:

composer create-project laravel/laravel:^11.0 project-name
composer require laravel/jetstream --no-interaction
php artisan jetstream:install livewire --teams --no-interaction

I'm failing to reproduce this bug. Vemto doesn't crate these migrations; they are created from the Laravel installing process, so I think there is something wrong with the composer installer. Maybe upgrading composer and PHP?

Akalanka1337 commented 4 months ago

Having same issue ( on Mac), ill try with commands.

Akalanka1337 commented 4 months ago

With the command: php artisan jetstream:install livewire --teams --no-interaction

I'm getting the following error:

No security vulnerability advisories found.
Using version ^5.1 for laravel/jetstream
> Mac@User Tester % php artisan jetstream:install livewire --teams --no-interaction
sh: line 0: exec: composer: not found
TiagoSilvaPereira commented 4 months ago

@Akalanka1337, does this error also happen when executing the command manually from your command line?

Akalanka1337 commented 4 months ago

Yes 🥺

On Mon, 13 May 2024 at 7:27 PM, Tiago S. P. Rodrigues < @.***> wrote:

@Akalanka1337 https://github.com/Akalanka1337, does this error also happen when executing the command manually from your command line?

— Reply to this email directly, view it on GitHub https://github.com/TiagoSilvaPereira/vemto2-issues/issues/102#issuecomment-2107648318, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUC5PSGRI32TADSNOX4UEALZCDBD5AVCNFSM6AAAAABGYTJUGOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBXGY2DQMZRHA . You are receiving this because you were mentioned.Message ID: @.***>

TiagoSilvaPereira commented 4 months ago

@Akalanka1337 it seems this is a problem with the Jetstream Installer. Please check this:

https://github.com/laravel/jetstream/issues/586

TiagoSilvaPereira commented 4 months ago

Please also check: https://github.com/laravel/jetstream/pull/588

TiagoSilvaPereira commented 4 months ago

@Akalanka1337 it seems this problem happens when composer is not globally installed (Jetstream installer needs composer globally installed). But I think I can try fixing in a future Vemto version by adding the --composer parameter to the jetstream installer.

For now, please try installing composer globally.

argelium commented 4 months ago

@argelium could you please try creating the project from command line and see what happens? Vemto executes the following commands in sequence:

composer create-project laravel/laravel:^11.0 project-name
composer require laravel/jetstream --no-interaction
php artisan jetstream:install livewire --teams --no-interaction

I'm failing to reproduce this bug. Vemto doesn't crate these migrations; they are created from the Laravel installing process, so I think there is something wrong with the composer installer. Maybe upgrading composer and PHP?

Hello, I ran these commands manually and there was no error. Maybe something is wrong with my configuration. I'll do some more testing and get back to you.

Akalanka1337 commented 4 months ago

@TiagoSilvaPereira Great! Problem solved! After installing Composer using Brew, I was able to create projects using Vemto successfully.

@Akalanka1337 it seems this problem happens when composer is not globally installed (Jetstream installer needs composer globally installed). But I think I can try fixing in a future Vemto version by adding the --composer parameter to the jetstream installer.

For now, please try installing composer globally.

TiagoSilvaPereira commented 4 months ago

@argelium any info about this? It this still happening when creating a new project using Vemto 2.0.14? Could you please record a video showing this happening?

mrambil commented 3 months ago

Hi @TiagoSilvaPereira, here is a short recording.

Tell me if you need anything else.

https://github.com/TiagoSilvaPereira/vemto2-issues/assets/21106790/8742ab29-ac03-4268-8698-3c5a9fb6dfbf

TiagoSilvaPereira commented 3 months ago

Hi @mrambil it seems this is not a Vemto issue. This error is probably being fired from Jetstream (Jetstream also tries to execute composer). It seems the same error that happened with @Akalanka1337

You can check this for reference: https://github.com/laravel/jetstream/issues/586

TiagoSilvaPereira commented 3 months ago

@argelium, is this problem still occurring with you with Vemto 2.0.15?

TiagoSilvaPereira commented 3 months ago

@argelium I'm closing for now. Probably this issue was already solved on Vemto 2.0.17. But feel free to open another issue if necessary