laravelbreeze

installation of breeze in laravel 10 gives module error


I created a project in laravel 10 and then installed breeze, it gave me the following error after installation, and after running npm run dev

(node:12156) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)

my package.json file is like this:

{
    "private": true,
    "scripts": {
        "dev": "vite --host --port 8000",
        "build": "vite build",
        "type": "module"
    },
    "devDependencies": {
        "@tailwindcss/forms": "^0.5.2",
        "alpinejs": "^3.4.2",
        "autoprefixer": "^10.4.2",
        "axios": "^1.1.2",
        "laravel-vite-plugin": "^0.7.2",
        "postcss": "^8.4.6",
        "tailwindcss": "^3.1.0",
        "vite": "^4.0.0"
    }
}

Solution

  • In the file package.json, changed in this way and works:

    "private": true,
        "type": "module",
        "scripts": {
            "dev": "vite",
            "build": "vite build"
        },
    .....