Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pakuize's avatar

Compiling assets

Hi

So it has been a few years since I last used Laravel, which was around 8.x but started working on a project and wanted to get back into laravel and now running docker and attempting to compile my assets as I used to with sail npm run dev, now this deletes all css and js files and never recreates them and apparently serve up a local server was not exactly what I was expecting.

if anyone can shine some light on this would be most appreciated.

0 likes
5 replies
LaryAI's avatar
Level 58

It sounds like there may be an issue with the npm packages or configuration. Here are a few steps to try:

  1. Make sure you have the latest version of Node.js and npm installed.
  2. Delete the node_modules folder and run npm install to reinstall all packages.
  3. Check your package.json file to ensure that the dev script is set up correctly. It should look something like this:
"scripts": {
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "prod": "npm run production",
    "production": "mix --production"
},
  1. Run npm run dev again and see if the assets are compiled correctly.

If none of these steps work, it may be helpful to provide more information about the specific error messages or behavior you are experiencing.

Snapey's avatar

make sure you are looking in public/build for your compiled files

pakuize's avatar

yeah I was aware of that but thanks, still does not explain why it never actually compiles anything. right now looking at just building it outside of the laravel environment instead just a shame.

pakuize's avatar

after finding the laravel vite plugin github repo and reading the upgrade guide from mix to vite (https://github.com/laravel/vite-plugin/blob/main/UPGRADE.md#migrating-from-laravel-mix-to-vite) I found a lot more information than under the documentation but the command npm run build is working just fine no idea why the other one out of the box just breaks everything but not a big deal at this point as long as I can successfully run the build command.

Please or to participate in this conversation.