I have a Symfony 5 application, i'm using webpack Encore / Ux for the first time. I'm facing difficulties with deployment, only the HTML is displayed at the URL ; the "build" directory is almost empty, it only contains "entrypoints.json" and "manifest.json". the assets aren't compiled. When im running npm run build to compile the assets in production i have this message :
sh: encore: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! @ build: encore production --progress
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
The build script in the package.json doesnt work : "scripts": { "dev-server": "encore dev-server", "dev": "encore dev", "watch": "encore dev --watch", "build": "encore production --progress" }
and i have no idea to where does this come from. Would someone have something for this ?
i ran npm run build and it doesnt work, but it does in dev mode
Before deploying to production server you need to Compile Assets for Production on your dev server.
Then deploy only the built assets.
The process is documented here:
https://symfony.com/doc/current/frontend/encore/faq.html#how-do-i-deploy-my-encore-assets