Laravel-debugbar: PhpDebugBar is not defined

Created on 21 Nov 2015  路  21Comments  路  Source: barryvdh/laravel-debugbar

Laravel 5.1

Uncaught ReferenceError: jQuery is not defined(anonymous function) @ (index):46
(index):48 Uncaught ReferenceError: PhpDebugBar is not defined

stale

Most helpful comment

I am getting this error when using a route with parameter which allows slashes in it, this overrides debug bar assets to request my controller instead.

Route::get('/{slug}', 'MainController@slug')->name('slug')->where('slug', '(.*)');

All 21 comments

Getting the same error,
Also get 404 error for the following requests:
GET http://localhost.dev/en/assets/javascript
GET http://genesis.dev/en/assets/stylesheets

:+1: I'm seeing this on a fresh install of 5.1 on the default "Laravel" screen.

I can agree with this. Fresh install of Laravel, default laravel screen, added the service providers, alias, published vendor, and the rest of the guides. Also did cache:clear and config:cache, and a few others.

My route list ends up like this:

| Domain | Method   | URI                          | Name                 | Action                                                                 | Middleware |
+--------+----------+------------------------------+----------------------+---------------------------------------------------------------         +------------+
|        | GET|HEAD | /                            |                      | Closure                                                                |            |
|        | GET|HEAD | _debugbar/assets/javascript  | debugbar.assets.js   | Barryvdh\Debugbar\Controllers\AssetController@js                       |            |
|        | GET|HEAD | _debugbar/assets/stylesheets | debugbar.assets.css  | Barryvdh\Debugbar\Controllers\AssetController@css                      |            |
|        | GET|HEAD | _debugbar/clockwork/{id}     | debugbar.clockwork   | Barryvdh\Debugbar\Controllers\OpenHandlerController@clockwork          |            |
|        | GET|HEAD | _debugbar/open               | debugbar.openhandler | Barryvdh\Debugbar\Controllers\OpenHandlerController@handle 

Get these error messages when trying to go to the welcome screen:
image

And i get 404 if i try to go to the JS manually.

@asaf050 It shouldn't inject the /en part, are you using some custom module to do that, or manually prefixing all routes?

@Pillus Is http://mfws/ your domain? Do you get a Laravel error or an apache/nginx error?

Yeah its the domain in my test environment,

Also the error is just a 404 not found from apache.

As a update for @barryvdh .

The 404's seems to be mostly related to rewrite not being enable, or has been edited in some ways.

For people that are doing fresh installs, it seems forgetting to enable mod_rewrite is many :)

For me setting Order allow,deny and Allow from all in my virtual host fixed this problem.

I am getting this error when using a route with parameter which allows slashes in it, this overrides debug bar assets to request my controller instead.

Route::get('/{slug}', 'MainController@slug')->name('slug')->where('slug', '(.*)');

@kiberzauras is right. Disabling the catch-all controller made it work in my case.

Does changing the order not fix that?
From the readme:
https://github.com/barryvdh/laravel-debugbar#installation

If you use a catch-all/fallback route, make sure you load the Debugbar ServiceProvider before your own App ServiceProviders.

Yes it does, fantastic!

I totally missed that.

@tacone What did you missed ? Would you please share i am also getting the same error. I am using prefix for all routes.

Resolved.

The Error in your routes file

Please find your route file have same dynamic variable name more than one time in same function.

Ex:

Route::get('purchase/quote/{id}/receive/{id}', [ 'as' => 'purchase.quote_receive.mail_sent', 'uses' => 'Purchase\QuoteReceiveController@mail_sent']);

The above example dynamic variable id presented in twice,

So I hope error came.

We were seeing this on an app instance running on port 8000. When we changed it to standard port 80 the error went away.

Laravel 5.1

Uncaught ReferenceError: jQuery is not defined(anonymous function) @ (index):46
(index):48 Uncaught ReferenceError: PhpDebugBar is not defined

By default, the server loads the index.html. You need to force the index.php in the browser row.

Laravel 5.8

Although I followed all the hints above, PhpDebugBar does not appear when I run the app on a remote server.

Error messages in the Firefox console (as above):

Loading failed for <script> "https://my.local.domain/app/_debugbar/assets/javascript?v=1566484194".
...
Reference Error: jQuery is not defined
Reference Error: PhpDebugBar is not defined
...

When serving the app locally via
php artisan serve
the debug bar is showing up.

@strike65 check your debug javascript is loading success; example: /_debugbar/assets/javascript?v=1567062063

@1cool Thanks! It was a case of "seeing the wood for the trees"... It works. Thanks again!

TL;TR
(checking the .env file -> APP_DEBUG = true ) I am ashamed...

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.

I got the same error . When i tried this i got the issue resolved

  1. composer update
  2. env changed APP_DEBUG=true to APP_DEBUG=false
  3. then php artisan config:cache
    4 .env changed APP_DEBUG=false to APP_DEBUG=true
  4. then php artisan config:cache
Was this page helpful?
0 / 5 - 0 ratings

Related issues

damienfern picture damienfern  路  4Comments

Thijmen picture Thijmen  路  6Comments

hussein-elhussein picture hussein-elhussein  路  3Comments

farshadff picture farshadff  路  4Comments

alphametric picture alphametric  路  5Comments