node.jslaravelbreezepostcsslaravel-jetstream

Error with postcss.config.js when installing Laravel Jetstream with Livewire


I am trying to install Jetstream in a Laravel project. Immediately after running the command php artisan jetstream:install livewire, this error appears:

`C:\xampp\htdocs\PFE\PFE\postcss.config.js:1
export default {
SyntaxError: Unexpected token 'export'
    at internalCompileFunction (node:internal/vm:76:18)
    at wrapSafe (node:internal/modules/cjs/loader:1283:20)
    at Module._compile (node:internal/modules/cjs/loader:1328:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
    at async importDefault (file:///C:/xampp/htdocs/PFE/PFE/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:36556:18)`

I updated Node.js to the latest version (v18.20.2), but the error still occurs. I hope that Laravel will work for me with Jetstream or Breeze normally and well. What can I do to resolve this issue?


Solution

  • Please make sure you have "type" : "module" in your package.json file.