Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when install on Laravel 6 #41

Closed
sanvu88 opened this issue Oct 10, 2020 · 7 comments
Closed

Error when install on Laravel 6 #41

sanvu88 opened this issue Oct 10, 2020 · 7 comments

Comments

@sanvu88
Copy link

sanvu88 commented Oct 10, 2020

Error when install on Laravel 6 - Php 7.3

Symfony\Component\Debug\Exception\FatalThrowableError : Argument 1 passed to PHPageBuilder\PHPageBuilder::__construct() must be of the type array, null given, called in E:\laragon\www\builder\vendor\hansschouten\laravel-pagebuilder\src\ServiceProvider.php on line 43

at E:\laragon\www\builder\vendor\hansschouten\phpagebuilder\src\PHPageBuilder.php:47
43| * PHPageBuilder constructor.
44| *
45| * @param array $config configuration in the format defined in config/config.example.php
46| */

47| public function __construct(array $config)
48| {
49| if (session_status() === PHP_SESSION_NONE) {
50| session_start();
51| }

Exception trace:

1 PHPageBuilder\PHPageBuilder::__construct()
E:\laragon\www\builder\vendor\hansschouten\laravel-pagebuilder\src\ServiceProvider.php:43

2 HansSchouten\LaravelPageBuilder\ServiceProvider::HansSchouten\LaravelPageBuilder{closure}(Object(Illuminate\Foundation\Application), [])
E:\laragon\www\builder\vendor\laravel\framework\src\Illuminate\Container\Container.php:799

@HansSchouten
Copy link
Owner

HansSchouten commented Oct 10, 2020

Can you check that you have the config/pagebuilder.php file?

This should be created after running php artisan vendor:publish --provider="HansSchouten\LaravelPageBuilder\ServiceProvider" --tag=config.

@sanvu88
Copy link
Author

sanvu88 commented Oct 11, 2020

Can you check that you have the config/pagebuilder.php file?

This should be created after running php artisan vendor:publish --provider="HansSchouten\LaravelPageBuilder\ServiceProvider" --tag=config.

When installing, the error is above, and the installation is not successful. So I can't publish the config file

@sanvu88
Copy link
Author

sanvu88 commented Oct 12, 2020

I tried creating the config file before installing, and it seems to have installed it, but with the following error

UnexpectedValueException : DirectoryIterator::__construct(E:\laragon\www\l6\themes/demo/blocks,E:\laragon\www\l6\themes/demo/blocks): The system cannot find the path specified. (code: 3)

at E:\laragon\www\l6\vendor\hansschouten\phpagebuilder\src\Theme.php:51
47| */
48| protected function loadThemeBlocks()
49| {
50| $this->blocks = [];

51| $blocksDirectory = new DirectoryIterator($this->getFolder() . '/blocks');
52| foreach ($blocksDirectory as $entry) {
53| if ($entry->isDir() && ! $entry->isDot()) {
54| $blockSlug = $entry->getFilename();
55| $block = new ThemeBlock($this, $blockSlug);

Exception trace:

1 DirectoryIterator::__construct("E:\laragon\www\l6\themes/demo/blocks")
E:\laragon\www\l6\vendor\hansschouten\phpagebuilder\src\Theme.php:51

2 PHPageBuilder\Theme::loadThemeBlocks()
E:\laragon\www\l6\vendor\hansschouten\phpagebuilder\src\Theme.php:41

@HansSchouten
Copy link
Owner

Will it work if you create the blocks folder that seems to be missing now?

@sanvu88
Copy link
Author

sanvu88 commented Oct 14, 2020

It's worked. Thank so much

@dsultanr
Copy link

dsultanr commented Oct 15, 2020

same error here, both on laravel 6.* and 7.*

tried clean install laravel with
composer create-project --prefer-dist laravel/laravel blog "7.*"

then
cd blog; composer require hansschouten/laravel-pagebuilder

ang got this:

root@29472cf8b0bd:/var/www/html/blog# composer require hansschouten/laravel-pagebuilder
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2.0 is about to be released and the older 1.x releases will self-update directly to it once it is released. To avoid surprises update now to the latest 1.x version which will prompt you before self-updating to 2.x.
Using version ^0.13.0 for hansschouten/laravel-pagebuilder
./composer.json has been updated
Loading composer repositories with package information
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2.0 is about to be released and the older 1.x releases will self-update directly to it once it is released. To avoid surprises update now to the latest 1.x version which will prompt you before self-updating to 2.x.
Updating dependencies (including require-dev)
Nothing to install or update
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   TypeError

  Argument 1 passed to PHPageBuilder\PHPageBuilder::__construct() must be of the type array, null given, called in /var/www/html/blog/vendor/hansschouten/laravel-pagebuilder/src/ServiceProvider.php on line 43

  at vendor/hansschouten/phpagebuilder/src/PHPageBuilder.php:47
    43|      * PHPageBuilder constructor.
    44|      *
    45|      * @param array $config         configuration in the format defined in config/config.example.php
    46|      */
  > 47|     public function __construct(array $config)
    48|     {
    49|         if (session_status() === PHP_SESSION_NONE) {
    50|             session_start();
    51|         }

      +15 vendor frames
  16  [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(HansSchouten\LaravelPageBuilder\ServiceProvider))

      +5 vendor frames
  22  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json to its original content.

@sanvu88
Copy link
Author

sanvu88 commented Oct 21, 2020

yup, first you need to create the file /config/pagebuilder.php with the content here https://github.com/HansSchouten/Laravel-Pagebuilder/blob/master/config/pagebuilder.php

Then create /themes/demo/blocks directory. (You may need to create more folders if it says a missing directory)

Finally let's install the package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants