jetstream: Uncaught ReferenceError: route is not defined
- Jetstream Version: 1.6.1
- Jetstream Stack: Inertia
- Laravel Version: 8.15.0
- PHP Version: 7.4.12
- Database Driver & Version: mysql v8.0.20
Description: Login page displays error on the web console. This message disappears once a user is logged in.
Uncaught ReferenceError: route is not defined at Module../resources/js/app.js
Steps To Reproduce:
- laravel new sample
- composer require laravel/jetstream
- php artisan jetstream:install inertia (or with --teams)
- npm install && npm run dev
- php artisan migrate
- php artisan serve
- Visit Login, Registration, or Forgot Password page to view error on console.

About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 15 (3 by maintainers)
This should fix it: https://github.com/laravel/jetstream/pull/485
I had this issue myself when installing Jetstream with Inertia for the first time where there were a few hiccups along the way i.e. the installer didn’t work as expected because of my local environment so I had to install a few dependencies manually.
For me once I’d created an account and was taken to /dashboard the issue was clearer since I could only see @routes output in the browser. This is because the @routes blade directive wasn’t available from the
tightenco/ziggyand should’ve been added by the installer (but it wasn’t because of those hiccups) https://github.com/laravel/jetstream/blob/daba98419164024e2c071f5547dd5569aba69d98/src/Console/InstallCommand.php#L249If that’s the same for you just do
composer require tightenco/ziggyand it should resolve your issue.The Laravel Jetstream login, two-factor login, registration, password reset, and email verification views have guest.blade.php as the base layout while everything else uses app.blade.php. In the guest.blade.php the @routes directive is missing but the mix(‘js/app.js’) depends on it. I tried adding it to the guest.blade.php template but now i get a

TypeError