blade-ui-kit / blade-heroicons

A package to easily make use of Heroicons in your Laravel Blade views.
https://blade-ui-kit.com/blade-icons
MIT License
560 stars 50 forks source link

Composer Update failed: The options for the "heroicons" set don't have a prefix defined. #21

Closed jonothedev closed 3 years ago

jonothedev commented 3 years ago

Description:

I have run the composer install command this morning and now face the following issue:

composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   BladeUI\Icons\Exceptions\CannotRegisterIconSet

  The options for the "heroicons" set don't have a prefix defined.

Steps To Reproduce:

Run a composer install

Do you know of any way round this or why this is happening?

driesvints commented 3 years ago

Did you:

  1. Clear icon cache with php artisan icons:clear?
  2. Clear config cache with php artisan config:clear?
  3. Are using the very latest version of this library?
jonothedev commented 3 years ago

@driesvints i can't run those commands because of this issue and yes 1.2.0

php artisan icons:clear

   BladeUI\Icons\Exceptions\CannotRegisterIconSet

  The options for the "heroicons" set don't have a prefix defined.

  at vendor/blade-ui-kit/blade-icons/src/Exceptions/CannotRegisterIconSet.php:23
     19▕     }
     20▕
     21▕     public static function prefixNotDefined(string $set): self
     22▕     {
  ➜  23▕         return new self("The options for the \"$set\" set don't have a prefix defined.");
     24▕     }
     25▕
     26▕     public static function prefixNotUnique(string $set, string $collidingSet): self
     27▕     {

      +40 vendor frames
  41  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
driesvints commented 3 years ago

Are you only using Blade Heroicons or also Blade Icons directly? (if so, paste your blade-icons.php config file.

Is there a blade-icons.php file in bootstrap/cache? (if so, delete it)

jonothedev commented 3 years ago

I'm using blade heroicons directly, there's also no blade-icons.php within the bootstrap/cache directory.

Config below:


return [

    /*
    |--------------------------------------------------------------------------
    | Icons Sets
    |--------------------------------------------------------------------------
    |
    | With this config option you can define a couple of
    | default icon sets. Provide a key name for your icon
    | set and a combination from the options below.
    |
    */

    'sets' => [

        // 'default' => [
        //
        //     /*
        //     |-----------------------------------------------------------------
        //     | Icons Path
        //     |-----------------------------------------------------------------
        //     |
        //     | Provide the relative path from your app root to your SVG icons
        //     | directory. Icons are loaded recursively so there's no need to
        //     | list every sub-directory.
        //     |
        //     | Relative to the disk root when the disk option is set.
        //     |
        //     */
        //
        //     'path' => 'resources/svg',
        //
        //     /*
        //     |-----------------------------------------------------------------
        //     | Filesystem Disk
        //     |-----------------------------------------------------------------
        //     |
        //     | Optionally, provide a specific filesystem disk to read
        //     | icons from. When defining a disk, the "path" option
        //     | starts relatively from the disk root.
        //     |
        //     */
        //
        //     'disk' => '',
        //
        //     /*
        //     |-----------------------------------------------------------------
        //     | Default Prefix
        //     |-----------------------------------------------------------------
        //     |
        //     | This config option allows you to define a default prefix for
        //     | your icons. The dash separator will be applied automatically
        //     | to every icon name. It's required and needs to be unique.
        //     |
        //     */
        //
        //     'prefix' => 'icon',
        //
        //     /*
        //     |-----------------------------------------------------------------
        //     | Fallback Icon
        //     |-----------------------------------------------------------------
        //     |
        //     | This config option allows you to define a fallback
        //     | icon when an icon in this set cannot be found.
        //     |
        //     */
        //
        //     'fallback' => '',
        //
        //     /*
        //     |-----------------------------------------------------------------
        //     | Default Set Classes
        //     |-----------------------------------------------------------------
        //     |
        //     | This config option allows you to define some classes which
        //     | will be applied by default to all icons within this set.
        //     |
        //     */
        //
        //     'class' => '',
        //
        //     /*
        //     |-----------------------------------------------------------------
        //     | Default Set Attributes
        //     |-----------------------------------------------------------------
        //     |
        //     | This config option allows you to define some attributes which
        //     | will be applied by default to all icons within this set.
        //     |
        //     */
        //
        //     'attributes' => [
        //         // 'width' => 50,
        //         // 'height' => 50,
        //     ],
        //
        // ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Global Default Classes
    |--------------------------------------------------------------------------
    |
    | This config option allows you to define some classes which
    | will be applied by default to all icons.
    |
    */

    'class' => '',

    /*
    |--------------------------------------------------------------------------
    | Global Default Attributes
    |--------------------------------------------------------------------------
    |
    | This config option allows you to define some attributes which
    | will be applied by default to all icons.
    |
    */

    'attributes' => [
        // 'width' => 50,
        // 'height' => 50,
    ],

    /*
    |--------------------------------------------------------------------------
    | Global Fallback Icon
    |--------------------------------------------------------------------------
    |
    | This config option allows you to define a global fallback
    | icon when an icon in any set cannot be found. It can
    | reference any icon from any configured set.
    |
    */

    'fallback' => '',

    /*
    |--------------------------------------------------------------------------
    | Components
    |--------------------------------------------------------------------------
    |
    | These config options allow you to define some
    | settings related to Blade Components.
    |
    */

    'components' => [

        /*
        |----------------------------------------------------------------------
        | Disable Components
        |----------------------------------------------------------------------
        |
        | This config option allows you to disable Blade components
        | completely. It's useful to avoid performance problems
        | when working with large icon libraries.
        |
        */

        'disabled' => false,

        /*
        |----------------------------------------------------------------------
        | Default Icon Component Name
        |----------------------------------------------------------------------
        |
        | This config option allows you to define the name
        | for the default Icon class component.
        |
        */

        'default' => 'icon',

    ],

];

Thanks

driesvints commented 3 years ago

hmm, you shouldn't be needing that config file then. You can remove it.

Is there a config.php file in your bootstrap/cache directory? If so, try removing it.

jonothedev commented 3 years ago

That seems to have done the trick.

Thanks @driesvints

driesvints commented 3 years ago

@jonojamesmac just for the future: don't cache your config in development and clear it while deploying to production. Otherwise you'll run into these kind of things.