ARCANEDEV/LaravelLang

Error with vendor path equals false

silasrm opened this issue · 12 comments

Hi,

I'm using this package and when run any artisan command in instalation, this error occurs:

The "" directory does not exist.

Stack trace:

[2016-08-18 13:06:57] local.ERROR: exception 'InvalidArgumentException' with message 'The "" directory does not exist.' in /.../vendor/symfony/finder/Finder.php:546
Stack trace:
#0 /.../vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(366): Symfony\Component\Finder\Finder->in(false)
#1 /.../vendor/arcanedev/laravel-lang/src/TransManager.php(104): Illuminate\Filesystem\Filesystem->directories(false)
#2 /.../vendor/arcanedev/laravel-lang/src/TransManager.php(89): Arcanedev\LaravelLang\TransManager->loadDirectories(false)
#3 /.../vendor/arcanedev/laravel-lang/src/TransManager.php(62): Arcanedev\LaravelLang\TransManager->load()
#4 /.../vendor/arcanedev/laravel-lang/src/LaravelLangServiceProvider.php(113): Arcanedev\LaravelLang\TransManager->__construct(Object(Illuminate\Filesystem\Filesystem), Array)
#5 /.../vendor/laravel/framework/src/Illuminate/Container/Container.php(735): Arcanedev\LaravelLang\LaravelLangServiceProvider->Arcanedev\LaravelLang\{closure}(Object(Illuminate\Foundation\Application), Array)

The $paths inside vendor/arcanedev/laravel-lang/src/LaravelLangServiceProvider.php:108 return:

array(2) {
  ["app"]=>string(51) "/.../resources/lang"
  ["vendor"]=>bool(false)
}

vendor paths with false value broke Arcanedev\LaravelLang\TransManager->loadDirectories.

config/laravel-lang.php:

<?php

return [
    /* ------------------------------------------------------------------------------------------------
     |  The vendor path.
     | ------------------------------------------------------------------------------------------------
     */
    /** @link      https://github.com/caouecs/Laravel-lang */
    'vendor'    => base_path('vendor/caouecs/laravel-lang/src'),

    /* ------------------------------------------------------------------------------------------------
     |  Supported locales
     | ------------------------------------------------------------------------------------------------
     | If you want to limit your translations, set your supported locales list.
     */
    'locales'   => ['pt-BR', 'en'],

    /* ------------------------------------------------------------------------------------------------
     |  Check Settings
     | ------------------------------------------------------------------------------------------------
     */
    'check'     => [
        'ignore'  => [
            'validation.custom',
            'validation.attributes',
        ],
    ],
];

PHP 5.6.10.
Packages:

  • arcanedev/laravel-lang => 1.3.0
  • caouecs/laravel-lang => 3.0.11
  • Laravel Framework => 5.2.34

Any idea?

OK, i'm going to check the issue and see if i can resolve it.

Thanks and stay tuned 👍

Ok, I'm awaiting :D

Hi @silasrm, i've just tested the package with a fresh laravel installation and i can't reproduce your issue.

This is my composer dependencies:

"require": {
    "php": ">=5.5.9",
    "laravel/framework": "5.2.*",
    "arcanedev/laravel-lang": "^1.3"
},

Laravel Framework version 5.2.43

config/app.php file:

'providers' => [
    // Laravel Framework Service Providers...
    // Application Service Providers...

    Arcanedev\LaravelLang\LaravelLangServiceProvider::class,
],

And finally my config/laravel-lang.php file:

<?php

return [
    /* ------------------------------------------------------------------------------------------------
     |  The vendor path.
     | ------------------------------------------------------------------------------------------------
     */
    /** @link      https://github.com/caouecs/Laravel-lang */
    'vendor'    => base_path('vendor/caouecs/laravel-lang/src'),

    /* ------------------------------------------------------------------------------------------------
     |  Supported locales
     | ------------------------------------------------------------------------------------------------
     | If you want to limit your translations, set your supported locales list.
     */
    'locales'   => ['pt-BR', 'en'],

    /* ------------------------------------------------------------------------------------------------
     |  Check Settings
     | ------------------------------------------------------------------------------------------------
     */
    'check'     => [
        'ignore'  => [
            'validation.custom',
            'validation.attributes',
        ],
    ],
];

Make sure you've installed/configured your app correctly (follow the steps in the documentation), you can also try with a new laravel installation and see what you've done wrong.

In local server is ok, but in production server occurs this error.

In my composer.json, I use:

"require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "arcanedev/laravel-lang": "~1.0",
    },

I'll try again.

OK, try to run composer update in your production server to sync all the packages.

And let me know if you solved your issue.

I update all packages, include this, but nothing change :(

OK. Your issue is when you get the vendor folder path from config file (at this line), the realpath function gonna return the real path of the folder, if the folder doesn't exist, is going to return false.

Try to dd() the $config->get('laravel-lang.vendor', '') before the $paths variable and see what you got.

And check that the base_path('vendor/caouecs/laravel-lang/src') folder exists in your project (you can dd() it to see the full path).

@arcanedev-maroc the error is because the bootstrap/cache/* files is generated localy and versioned. In the server the path is other, and this cause the error in realpath.

Now, everything is ok 💃

Sorry for this situation. Thk's!

You're welcome, glad that you solved your issue.

@silasrm How did you solve the issue? Would you please let me know? Thanks.

Hi @TOP-DEVELOPER,

I've add cache in git versioning and in other server, this cause error because of path of project is different of the localy :(

@TOP-DEVELOPER : try this

git rm -f cache
composer install