Closed huna02 closed 3 years ago
I have no idea why but your problem is not with Voyager, for some reason Laravel users migration is not running so Voyager migration does not work.
I did the same exact steps and it works just fine.
composer create-project laravel/laravel test.app
cd test.app
composer require tcg/voyager
touch database/database.sqlite
vim .env
php artisan voyager:install
Successfully installed Voyager! Enjoy
hm.
tried same on a couple of different machines; same fail.
also an issue if I 1st throw jetstream into the mix
composer create-project laravel/laravel test.app
cd test.app
composer require laravel/jetstream
php artisan jetstream:install livewire --teams
npm install
npm run dev
edit .env
-> DB setup
php artisan migrate
composer require tcg/voyager
Using version ^1.4 for tcg/voyager
./composer.json has been updated
Running composer update tcg/voyager
Loading composer repositories with package information
Updating dependencies
Lock file operations: 20 installs, 0 updates, 0 removals
- Locking arrilot/laravel-widgets (3.13.1)
- Locking composer/ca-bundle (1.2.9)
- Locking composer/composer (2.0.11)
- Locking composer/semver (3.2.4)
- Locking composer/spdx-licenses (1.5.5)
- Locking composer/xdebug-handler (1.4.5)
- Locking doctrine/cache (1.10.2)
- Locking doctrine/dbal (2.12.1)
- Locking doctrine/event-manager (1.1.1)
- Locking intervention/image (2.5.1)
- Locking justinrainbow/json-schema (5.2.10)
- Locking larapack/doctrine-support (v0.1.9)
- Locking larapack/hooks (v1.0.12)
- Locking larapack/voyager-hooks (v1.2.3)
- Locking laravel/ui (v3.2.0)
- Locking react/promise (v2.8.0)
- Locking seld/jsonlint (1.8.3)
- Locking seld/phar-utils (1.1.1)
- Locking symfony/filesystem (v5.2.4)
- Locking tcg/voyager (1.x-dev e9160b7)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 20 installs, 0 updates, 0 removals
- Syncing tcg/voyager (1.x-dev e9160b7) into cache
- Installing composer/ca-bundle (1.2.9): Extracting archive
- Installing composer/semver (3.2.4): Extracting archive
- Installing composer/spdx-licenses (1.5.5): Extracting archive
- Installing composer/xdebug-handler (1.4.5): Extracting archive
- Installing doctrine/cache (1.10.2): Extracting archive
- Installing doctrine/event-manager (1.1.1): Extracting archive
- Installing justinrainbow/json-schema (5.2.10): Extracting archive
- Installing symfony/filesystem (v5.2.4): Extracting archive
- Installing seld/phar-utils (1.1.1): Extracting archive
- Installing seld/jsonlint (1.8.3): Extracting archive
- Installing react/promise (v2.8.0): Extracting archive
- Installing composer/composer (2.0.11): Extracting archive
- Installing larapack/hooks (v1.0.12): Extracting archive
- Installing laravel/ui (v3.2.0): Extracting archive
- Installing larapack/voyager-hooks (v1.2.3): Extracting archive
- Installing doctrine/dbal (2.12.1): Extracting archive
- Installing larapack/doctrine-support (v0.1.9): Extracting archive
- Installing intervention/image (2.5.1): Extracting archive
- Installing arrilot/laravel-widgets (3.13.1): Extracting archive
- Installing tcg/voyager (1.x-dev e9160b7): Cloning e9160b7c10 from cache
4 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
PHP Fatal error: Trait 'Laravel\Sanctum\HasApiTokens' not found in /home/dev/test.app/app/Models/User.php on line 14
PHP Fatal error: Uncaught ErrorException: Function must be enabled in php.ini by setting 'xdebug.mode' to 'develop' in /home/dev/test.app/vendor/symfony/error-handler/Error/FatalError.php:37
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Function must b...', '/home/dev/t...', 37, Array)
#1 /home/dev/test.app/vendor/symfony/error-handler/Error/FatalError.php(37): xdebug_get_function_stack()
#2 /home/dev/test.app/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(143): Symfony\Component\ErrorHandler\Error\FatalError->__construct('Trait 'Laravel\\...', 0, Array, 0)
#3 /home/dev/test.app/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(130): Illuminate\Foundation\Bootstrap\HandleExceptions->fatalErrorFromPhpError(Array, 0)
#4 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions in /home/dev/test.app/vendor/symfony/error-handler/Error/FatalError.php on line 37
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
PHP Fatal error: Trait 'Laravel\Sanctum\HasApiTokens' not found in /home/dev/test.app/app/Models/User.php on line 14
This is not related to Voyager.
it only appears when attempting to require tcg/voyager
.
but, ok. thx anyway.
That happens when you require tcg/voyager
does not mean that is voyager fault, but only that voyager install does some things that require your app to be setup properly and it looks like it's not for some reason.
Did you try to install jetstream and see if it works without installing Voyager?
yep
laravel is OK laravel + jetstream is OK laravel + jetstream + Nova is OK laravel + jetstream + Backback is OK ... etc ... laravel + jetstream + !voyager is OK
Its not voyager issue. Looks like you are using sanctum without installing it. Try composer require laravel/sanctum
@rohankhudedev laravel/sanctum should be already automatically installed with those steps. @huna02 as you can see below I tried and I cannot reproduce your problem. Both errors you are seeing are not related to Voyager even if they happen when you require voyager.
SQLSTATE[HY000]: General error: 1 no such table: users (SQL: alter table "users" add column "avatar" varchar default 'users/default.png')
Users table migration did not run for some reason
PHP Fatal error: Trait 'Laravel\Sanctum\HasApiTokens' not found in /home/dev/test.app/app/Models/User.php on line 14
Sanctum is not installed for some reason
I don't see the point of keeping this issue open as I have no way to reproduce it and it looks unrelated but if you have something new that we can connect to Voyager we can reopen it.
Tried to reproduce error with no success:
composer create-project laravel/laravel test.app ;
cd test.app ;
composer require laravel/jetstream ;
php artisan jetstream:install livewire --teams ;
npm install ;
npm run dev ;
touch database/database.sqlite ;
vim .env ;
db configuration
php artisan migrate ;
php artisan serve ;
Working
composer require tcg/voyager ;
Package manifest generated successfully.
Still working
php artisan voyager:install --with-dummy
php artisan serve ;
Still working
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
## Version information
## Description clean install of laravel8 + voyager fails with error
## Steps To Reproduce