ArielMejiaDev / larapex-charts

A Laravel wrapper for apex charts
https://larapex-charts.netlify.app/
MIT License
290 stars 83 forks source link

php artisan make:chart is not a recognized command #34

Closed Eixix closed 3 years ago

Eixix commented 3 years ago

When entering php artisan make:chart MyChart, the command is not recognized with the error Command "make:chart" is not defined.. The command does not appear as a possible command when using php artisan list. My composer.json looks like this:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^8.0",
        "ext-intl": "*",
        "ext-json": "*",
        "ext-pdo": "*",
        "arielmejiadev/larapex-charts": "^2.1",
        "barryvdh/laravel-dompdf": "^0.9.0",
        "beyondcode/laravel-websockets": "^1.12",
        "codezero/laravel-unique-translation": "^3.4",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "grkamil/laravel-telegram-logging": "^v1.4.2",
        "guzzlehttp/guzzle": "^7.1.0",
        "laravel-arcanist/arcanist": "^0.3.0",
        "laravel/framework": "^8.6",
        "laravel/telescope": "^4.4",
        "laravel/tinker": "^2.4",
        "laravel/ui": "^3.0",
        "league/flysystem-sftp": "~1.0",
        "maatwebsite/excel": "^3.1",
        "predis/predis": "^1.1",
        "sopamo/laravel-filepond": "^0.6.1",
        "spatie/laravel-backup": "^7.5",
        "spatie/laravel-menu": "^3.6",
        "spatie/laravel-sluggable": "^2.6",
        "spatie/laravel-translatable": "^4.6",
        "spatie/menu": "^2.8",
        "tymon/jwt-auth": "^1.0"
    },
    "require-dev": {
        "barryvdh/laravel-ide-helper": "^2.7",
        "facade/ignition": "^2.3.7",
        "fzaninotto/faker": "^1.9.1",
        "imanghafoori/laravel-microscope": "dev-master",
        "laravel/dusk": "^6.10.0",
        "matt-allan/laravel-code-style": "^0.6.0",
        "mockery/mockery": "^1.4.0",
        "mrclay/shibalike": "^1.0",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ],
        "check-style": "php-cs-fixer fix --dry-run --diff",
        "fix-style": "php-cs-fixer fix"
    }
}
hubatruck commented 3 years ago

Hi,

Does the file under app/Console/Commands/ChartMakeCommand.php exist? If no, this might be caused because you didn't publish the config using the following command:

php artisan vendor:publish --tag=larapex-charts-config

If it is there, the command php artisan make:chart should be registered otherwise.

ArielMejiaDev commented 3 years ago

Check that you have in your project the command in app/Console/Commands/ChartMakeCommand.php and check that you have the stubs in the base project directory with chart stubs.

Eixix commented 3 years ago

Hey, even after publishing the config file, there is still no command file :(

hubatruck commented 3 years ago

For some reasons, with your composer.json configuration the command indeed does not get published, just the config file. I think the following workaround should fix your issue:

 php artisan vendor:publish --provider="ArielMejiaDev\LarapexCharts\LarapexChartsServiceProvider"

This hopefully will copy everything the package publishes. If it still does not work, make sure you have the latest version installed of larapex-charts, and try again that way.

Eixix commented 3 years ago

Sorry bad news. Even with this command it does not work. The output is:

Copied Directory [/vendor/arielmejiadev/larapex-charts/public] To [/public/vendor/larapex-charts]
Copied Directory [/vendor/arielmejiadev/larapex-charts/resources/views] To [/resources/views/vendor/larapex-charts]
Publishing complete.
hubatruck commented 3 years ago

Yes, the output is like that, but it should publish the command and the stubs too in the background. https://github.com/ArielMejiaDev/larapex-charts/blob/56fc693dc27c7eda0b9925c905a4d34ce5d9669f/src/LarapexChartsServiceProvider.php#L48-L52

Please make sure, you have version 3.0.0 or greater installed, as in prior versions (2.x) this referenced code isn't present see here, thus the package does not publish the command.

Eixix commented 3 years ago

Allright, that was totally my fault for installing the wrong version in the first place. Many thanks!