Home > Enterprise >  Npm run dev stuck at APP_URL
Npm run dev stuck at APP_URL

Time:07-09

I created a new laravel project, installed breeze auth and ran npm install and npm run dev. But it's stuck at this screen for 15 minutes now. Nothing is moving on the terminal window.

All the commands I used was

laravel new shop
composer require laravel/breeze
php artisan breeze:install
npm install
npm run dev

Everything worked fine until npm run dev, but when I enter npm run dev command, I get this output and nothing else.

PS C:\shop> npm run dev

> dev
> vite

  vite v2.9.13 dev server running at:

  > Local: http://localhost:3000/
  > Network: use `--host` to expose

  ready in 364ms.


  Laravel v9.19.0

  > APP_URL: http://shop.test

CodePudding user response:

I used npm run build instead npm run dev. And that solved it, I guess.

CodePudding user response:

I faced the same problem. I tried for many hours to solve this problem. Laravel 9 is using Vite to replace Laravel Mix for bundling assets. https://laravel.com/docs/9.x/vite#main-content

Starter kit components like Laravel Breeze and Jetstream have been using @vite

@vite(['resources/css/app.css', 'resources/js/app.js'])

When we run npm run dev vite will create own host below.

> dev
> vite

vite v2.9.13 dev server running at:

> Local: http://localhost:3000/
> Network: use `--host` to expose

ready in 364ms.


Laravel v9.19.0

> APP_URL: http://shop.test

And alway embed our style and script with this host http://127.0.0.1:3000/

<link rel="stylesheet" href="http://127.0.0.1:3000/resources/css/app.css">
<script type="module" src="http://127.0.0.1:3000/resources/js/app.js"></script>

I found a file name hot in the folder public was been created during we run command npm run dev and it is never delete. To work around I just delete this file (hot).

I don't know what happen after we run command npm run build it still exist. I hope that next release version of Laravel Vite will fix this issue.

CodePudding user response:

Laravel version 9.19.0 replaced Mixer with Vite for more information check Bundling Assets (Vite)

if you want to work mixer install Laravel version /= 9.1.0

composer create-project Laravel/Laravel app_name 9.1.0

  • Related