Laravel-modules: Issue start.stub and routes.stub . Not found in package

Created on 7 Mar 2019  路  13Comments  路  Source: nWidart/laravel-modules

I installed 4.0.0 version and when write: php artisan module:make MyNewModule and:


ErrorException : file_get_contents(/home/docker/src/blsflow/vendor/nwidart/laravel-modules/src/Support/../Commands/stubs/routes.stub): failed to open stream: No such file or directory

at /home/docker/src/blsflow/vendor/nwidart/laravel-modules/src/Support/Stub.php:106
102| * @return mixed|string
103| */
104| public function getContents()
105| {

106| $contents = file_get_contents($this->getPath());
107|
108| foreach ($this->replaces as $search => $replace) {
109| $contents = str_replace('$' . strtoupper($search) . '$', $replace, $contents);
110| }

Exception trace:

1 file_get_contents("/home/docker/src/blsflow/vendor/nwidart/laravel-modules/src/Support/../Commands/stubs/routes.stub")
/home/docker/src/blsflow/vendor/nwidart/laravel-modules/src/Support/Stub.php:106

2 Nwidart\Modules\Support\Stub::getContents()
/home/docker/src/blsflow/vendor/nwidart/laravel-modules/src/Support/Stub.php:122

Please use the argument -v to see more details.


ErrorException : file_get_contents(/home/docker/src/blsflow/vendor/nwidart/laravel-modules/src/Support/../Commands/stubs/start.stub): failed to open stream: No such file or directory

at /home/docker/src/blsflow/vendor/nwidart/laravel-modules/src/Support/Stub.php:106
102| * @return mixed|string
103| */
104| public function getContents()
105| {

106| $contents = file_get_contents($this->getPath());
107|
108| foreach ($this->replaces as $search => $replace) {
109| $contents = str_replace('$' . strtoupper($search) . '$', $replace, $contents);
110| }

Exception trace:

1 file_get_contents("/home/docker/src/blsflow/vendor/nwidart/laravel-modules/src/Support/../Commands/stubs/start.stub")
/home/docker/src/blsflow/vendor/nwidart/laravel-modules/src/Support/Stub.php:106

2 Nwidart\Modules\Support\Stub::getContents()
/home/docker/src/blsflow/vendor/nwidart/laravel-modules/src/Support/Stub.php:122

Please use the argument -v to see more details.

Copied from 3.0.0 version in to stubs and worked.

waiting-for-feedback

Most helpful comment

@rebortec Try to run this: php artisan vendor:publish --provider="Nwidart\Modules\LaravelModulesServiceProvider" --force

All 13 comments

Hi,

Strange I can't reproduce this. Maybe an install/update issue happened.

Same issue on php 7.2,
"laravel/framework": "5.7.*",
"nwidart/laravel-modules": "^4.0",

In Stub.php line 106:

file_get_contents(/srv/medimax/vendor/nwidart/laravel-modules/src/Support/.
./Commands/stubs/start.stub): failed to open stream: No such file or direct
ory

Process finished with exit code 1

However, "nwidart/laravel-modules": "^3.0", generates a module normally.

I'm having the same problem

    "require": {
        "php": "^7.2.0",
        "laravel/framework": "^5.8",
        "nwidart/laravel-modules": "^5.0"
    }
glmagalhaes@localhost ~/Documentos/repositorios/api2-cobalto [dev =]
qua mar 27 13:41:19 $ php artisan module:make Calendarios -v
Created : /home/glmagalhaes/Documentos/repositorios/api2-cobalto/Modules/Calendarios/module.json

   ErrorException  : file_get_contents(/home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/nwidart/laravel-modules/src/Support/../Commands/stubs/start.stub): failed to open stream: No such file or directory

  at /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/nwidart/laravel-modules/src/Support/Stub.php:106
    102|      * @return mixed|string
    103|      */
    104|     public function getContents()
    105|     {
  > 106|         $contents = file_get_contents($this->getPath());
    107| 
    108|         foreach ($this->replaces as $search => $replace) {
    109|             $contents = str_replace('$' . strtoupper($search) . '$', $replace, $contents);
    110|         }

  Exception trace:

  1   file_get_contents("/home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/nwidart/laravel-modules/src/Support/../Commands/stubs/start.stub")
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/nwidart/laravel-modules/src/Support/Stub.php:106

  2   Nwidart\Modules\Support\Stub::getContents()
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/nwidart/laravel-modules/src/Support/Stub.php:122

  3   Nwidart\Modules\Support\Stub::render()
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/nwidart/laravel-modules/src/Generators/ModuleGenerator.php:362

  4   Nwidart\Modules\Generators\ModuleGenerator::getStubContents("start")
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/nwidart/laravel-modules/src/Generators/ModuleGenerator.php:316

  5   Nwidart\Modules\Generators\ModuleGenerator::generateFiles()
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/nwidart/laravel-modules/src/Generators/ModuleGenerator.php:262

  6   Nwidart\Modules\Generators\ModuleGenerator::generate()
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/nwidart/laravel-modules/src/Commands/ModuleMakeCommand.php:41

  7   Nwidart\Modules\Commands\ModuleMakeCommand::handle()
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32

  8   call_user_func_array([])
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32

  9   Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:90

  10  Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Object(Closure))
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:34

  11  Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), [])
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/laravel/framework/src/Illuminate/Container/Container.php:580

  12  Illuminate\Container\Container::call()
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/laravel/framework/src/Illuminate/Console/Command.php:183

  13  Illuminate\Console\Command::execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/symfony/console/Command/Command.php:255

  14  Symfony\Component\Console\Command\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/laravel/framework/src/Illuminate/Console/Command.php:170

  15  Illuminate\Console\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/symfony/console/Application.php:908

  16  Symfony\Component\Console\Application::doRunCommand(Object(Nwidart\Modules\Commands\ModuleMakeCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/symfony/console/Application.php:269

  17  Symfony\Component\Console\Application::doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/symfony/console/Application.php:145

  18  Symfony\Component\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/laravel/framework/src/Illuminate/Console/Application.php:90

  19  Illuminate\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:122

  20  Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      /home/glmagalhaes/Documentos/repositorios/api2-cobalto/artisan:37

I'm still unable to reproduce this. Could any of you produce a sample project which I could take a look at?

Same problem here.

This is my composer.json file.

"require": {
    "php": ">=7.1.3",
    "laravel/framework": "5.8.*",
    "nwidart/laravel-modules": "^5.0"
},

Command: php artisan module:make MyModule

ErrorException  : file_get_contents(E:\Vagrant\Homestead\Temp\spcms\vendor\nwidart\laravel-modules\src\Support/../Commands/stubs/start.stub): failed to open stream: No such file or directory at E:\Vagrant\Homestead\Temp\spcms\vendor\nwidart\laravel-modules\src\Support\Stub.php:106
    102|      * @return mixed|string
    103|      */
    104|     public function getContents()
    105|     {
  > 106|         $contents = file_get_contents($this->getPath());
    107| 
    108|         foreach ($this->replaces as $search => $replace) {
    109|             $contents = str_replace('$' . strtoupper($search) . '$', $replace, $contents);
    110|         }

So, it seems in module config file if stubs section is default one, everything works fine.

But in my case, my stubs section is this:

'stubs' => [
        'enabled' => false,
        'path' => base_path() . '/vendor/nwidart/laravel-modules/src/Commands/stubs',
        'files' => [
            'start' => 'start.php',
            'routes/web' => 'Http/routes.php',
            'routes/api' => 'Http/api.php',
            'views/index' => 'Resources/views/index.blade.php',
            'views/master' => 'Resources/views/layouts/master.blade.php',
            'scaffold/config' => 'Config/config.php',
            'composer' => 'composer.json',
            'assets/js/app' => 'Resources/js/app.js',
            'assets/sass/app' => 'Resources/sass/app.scss',
        ],
        'replacements' => [
            'start' => ['LOWER_NAME'],
            'routes/web' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
            'routes/api' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
            'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
            'views/index' => ['LOWER_NAME'],
            'views/master' => ['STUDLY_NAME'],
            'scaffold/config' => ['STUDLY_NAME'],
            'composer' => [
                'LOWER_NAME',
                'STUDLY_NAME',
                'VENDOR',
                'AUTHOR_NAME',
                'AUTHOR_EMAIL',
                'MODULE_NAMESPACE',
            ],
        ],
        'gitkeep' => true,
    ],

And when I call php artisan module:make command, I get the ErrorException.

I assume, everyone have made some kind of changes in this section of the module config file, so then the error happens.

Looks like you guys have some old keys in your config file. Just like #640 and #688: make sure you compare your config file against the one for the release you are upgrading to.

You should also note that @nWidart follows SemVer, even if Laravel does not. So v5 is a major update from v4, and you should expect breaking changes like this. Always check your config files when updating, not just with this package.

Hello

I already removed the package, installed again but the error continues:

ErrorException : file_get_contents(C:\xampp\htdocs\bpm\vendor\nwidart\laravel-modules\src\Support/../Commands/stubs/start.stub): failed to open stream: No such file or directory

at C:\xampp\htdocs\bpm\vendor\nwidart\laravel-modules\src\Support\Stub.php:106
102| * @return mixed|string
103| */
104| public function getContents()
105| {

106| $contents = file_get_contents($this->getPath());
107|
108| foreach ($this->replaces as $search => $replace) {
109| $contents = str_replace('$' . strtoupper($search) . '$', $replace, $contents);
110| }

I've tried a lot of possibilities, but the error persists

PHP 7.3.1
Laravel 5.8
laravel-modules v5

@rebortec Try to run this: php artisan vendor:publish --provider="Nwidart\Modules\LaravelModulesServiceProvider" --force

Work fine :)

php artisan vendor:publish --provider="Nwidart\Modules\LaravelModulesServiceProvider" --force

thanks

php artisan vendor:publish --provider="Nwidart\Modules\LaravelModulesServiceProvider" --force

above code its worked

this is my composer.json file

   "php": "^7.1.3",
  "laravel/framework": "5.8.*",
  "nwidart/laravel-modules": "^5.0"

@rebortec Try to run this: php artisan vendor:publish --provider="Nwidart\Modules\LaravelModulesServiceProvider" --force

And plus need run - php artisan config:cache

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Warchiefs picture Warchiefs  路  12Comments

githubmarau picture githubmarau  路  29Comments

kamov picture kamov  路  10Comments

jakecorn picture jakecorn  路  16Comments

Alercard picture Alercard  路  29Comments