25

I have tried tried to publish this package using

php artisan vendor:publish --provider="BeyondCode\LaravelWebSockets\WebSocketsServiceProvider" --tag="migrations"

but I am getting

Unable to locate publishable resources

publishing complete

I dont know what is the cause of the problem. Anybody who can help me.

Installation output

Installing beyondcode/laravel-websockets (1.4.0): Downloading (100%)
symfony/polyfill-intl-idn suggests installing ext-intl (For best performance)
symfony/psr-http-message-bridge suggests installing nyholm/psr7 (For a super lightweight PSR-7/17 implementation)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
symfony/event-dispatcher suggests installing symfony/dependency-injection
symfony/var-dumper suggests installing ext-intl (To show region name in time zone dump)
symfony/http-kernel suggests installing symfony/browser-kit
symfony/http-kernel suggests installing symfony/config
symfony/http-kernel suggests installing symfony/dependency-injection
react/event-loop suggests installing ext-event (~1.0 for ExtEventLoop)
react/event-loop suggests installing ext-pcntl (For signal handling support when using the StreamSelectLoop)
react/event-loop suggests installing ext-uv (* for ExtUvLoop)
paragonie/sodium_compat suggests installing ext-libsodium (PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.)
paragonie/sodium_compat suggests installing ext-sodium (PHP >= 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.)
voku/portable-ascii suggests installing ext-intl (Use Intl for transliterator_transliterate() support)
symfony/translation suggests installing symfony/config
symfony/translation suggests installing symfony/yaml
illuminate/support suggests installing moontoast/math (Required to use ordered UUIDs (^1.1).)
illuminate/support suggests installing ramsey/uuid (Required to use Str::uuid() (^3.7).)
illuminate/support suggests installing vlucas/phpdotenv (Required to use the Env class and env helper (^4.0).)
symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
symfony/routing suggests installing symfony/yaml (For using the YAML loader)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
symfony/routing suggests installing doctrine/annotations (For using the annotation loader)
illuminate/filesystem suggests installing league/flysystem (Required to use the Flysystem local and FTP drivers (^1.0).)
illuminate/filesystem suggests installing league/flysystem-aws-s3-v3 (Required to use the Flysystem S3 driver (^1.0).)
illuminate/filesystem suggests installing league/flysystem-cached-adapter (Required to use the Flysystem cache (^1.0).)
illuminate/filesystem suggests installing league/flysystem-sftp (Required to use the Flysystem SFTP driver (^1.0).)
illuminate/http suggests installing guzzlehttp/guzzle (Required to use the HTTP Client (^6.3.1|^7.0).)
illuminate/routing suggests installing nyholm/psr7 (Required to use PSR-7 bridging features (^1.2).)
symfony/service-contracts suggests installing symfony/service-implementation
symfony/console suggests installing symfony/lock
illuminate/console suggests installing dragonmantank/cron-expression (Required to use scheduler (^2.0).)
illuminate/console suggests installing guzzlehttp/guzzle (Required to use the ping methods on schedules (^6.3.1|^7.0).)
illuminate/database suggests installing doctrine/dbal (Required to rename columns and drop SQLite columns (^2.6).)
illuminate/database suggests installing fzaninotto/faker (Required to use the eloquent factory builder (^1.4).)
illuminate/database suggests installing illuminate/events (Required to use the observers with Eloquent (^7.0).)
illuminate/database suggests installing illuminate/pagination (Required to paginate the result set (^7.0).)
illuminate/queue suggests installing ext-pcntl (Required to use all features of the queue worker.)
illuminate/queue suggests installing ext-posix (Required to use all features of the queue worker.)
illuminate/queue suggests installing aws/aws-sdk-php (Required to use the SQS queue driver and DynamoDb failed job storage (^3.0).)
illuminate/queue suggests installing illuminate/redis (Required to use the Redis queue driver (^7.0).)
illuminate/queue suggests installing pda/pheanstalk (Required to use the Beanstalk queue driver (^4.0).)
guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses)
Writing lock file
Generating autoload files
D Malan
  • 10,272
  • 3
  • 25
  • 50
digitcores
  • 293
  • 1
  • 3
  • 7
  • Are you trying to install it into an existing Laravel project? What version of Laravel are you using? Did you post [this](https://github.com/beyondcode/laravel-websockets/issues/337) issue on Github? – D Malan Mar 17 '20 at 09:51
  • @DelenaMalan I am trying to install it on an existing project. My laravel version is Laravel Framework 6.18.0 – digitcores Mar 17 '20 at 09:55
  • Could you add steps to reproduce? From your github issue it looks like there was no `composer.json` when you installed laravel-websockets (it says " ./composer.json has been created"). If I run `composer create-project --prefer-dist laravel/laravel laravel-test-6.8 "6.18.0" && cd laravel-test-6.8 && composer require beyondcode/laravel-websockets && php artisan vendor:publish --provider="BeyondCode\LaravelWebSockets\WebSocketsServiceProvider" --tag="migrations"` it works. – D Malan Mar 17 '20 at 10:03
  • Thanks I had two composers and I deleted one. I has worked. – digitcores Mar 17 '20 at 10:16

14 Answers14

37
  1. First run command:

    php artisan vendor:publish
    

You will see list of things to publish:

enter image description here


  1. Select what you want to publish by giving the index number. If it is migration, type 20 and enter or if it config file, type 12 and enter etc.

I hope this will solve your error.

Sabaoon Bedar
  • 3,113
  • 2
  • 31
  • 37
  • Yes it works, but what is the problem with --tag parameter? – Čamo Jul 08 '21 at 21:14
  • 1
    I am not quite sure, but it would be due to versions compatibility, it would be of composer or laravel versions and the the package you are adding to the framework. The error is because the framework is not able to find the location sources and that is why it is happening. – Sabaoon Bedar Jul 09 '21 at 05:08
  • Great. Worked for me. – Boadu Philip Asare Jul 23 '21 at 13:38
17

I faced the same issue and now got it fixed, here how it was looking enter image description here

Executed following set of commands:

php artisan clear-compiled
composer dumpautoload

After that my php artisan vendor:publish --provider="Path\To\Class" ran successfully.

See complete screenshot below enter image description here

This link was helpful.

Imran Zahoor
  • 2,521
  • 1
  • 28
  • 38
14

It's all about running this command 'php artisan vendor:publish --provider' and then choosing the number that refers to files you want to publish.

khalid alsaleh
  • 173
  • 1
  • 7
5

I solved it by running composer update

shalonteoh
  • 1,994
  • 2
  • 15
  • 17
5

It solved my problem:

php artisan config:cache

and then

php artisan vendor:publish

Chose the number for the provider and you are done.

4

I had the same issue.. But in my case I simply forget to register the package ServiceProvider in app.php

Mohamed Salem Lamiri
  • 5,767
  • 6
  • 34
  • 47
3

Try to run command:

php artisan vendor:publish

and then choose which package you want to publish... I hope it will solve your problem.

dev__rezo
  • 61
  • 1
  • 5
1

It's same problem with me sir, i fixed it with :

Try run only php artisan vendor:publish and you will see all publishable, then you can choose which one you need by number of list.

0

Install composer locally then do a composer install.

user1148967
  • 23
  • 1
  • 4
0

I have face the same problem. So i have close the command terminal and try again. its working.

Ahmed Awan
  • 347
  • 3
  • 9
0

I've faced the same problem, I tried all the solutions, none of them worked..

I simply forgot to first run: composer require laravel/sanctum

After that, I had to run: composer update And after that I was able to execute: php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"

0

I'm using Laravel in Docker container so I created BASH script to call 'php artisan' from anywhere and this script just cut-off double-quotes (") from artisan command. When manually ran inside docker container then it works as expected.

VladSavitsky
  • 523
  • 5
  • 13
0

In my shell I needed to escape the backslashes.

Try

php artisan vendor:publish --provider="BeyondCode\\\\LaravelWebSockets\\\\WebSocketsServiceProvider" --tag="migrations"

Maybe two backslashes might also work.

Hendrik Pilz
  • 219
  • 2
  • 4
0

It sounds to me that somehow the ServiceProvider is not automatically registered (present) in your application, thus not executing the commands, which live there.

Try adding the service provider manually in your config/app.php:

'providers' => [
    // ...
    BeyondCode\LaravelWebSockets\WebSocketsServiceProvider::class,
];