Error on Deployment: No such file for FilamentAsset

I have this in my AppServiceProvider's boot method:
FilamentAsset::register([
Js::make('jsConfetti', 'node_modules/js-confetti/dist/js-confetti.min.js')->loadedOnRequest(),
]);
FilamentAsset::register([
Js::make('jsConfetti', 'node_modules/js-confetti/dist/js-confetti.min.js')->loadedOnRequest(),
]);
and I have this in my package.json:
"dependencies": {
"dragula": "^3.7.3",
"js-confetti": "^0.12.0",
"puppeteer": "^21.3.8"
}
"dependencies": {
"dragula": "^3.7.3",
"js-confetti": "^0.12.0",
"puppeteer": "^21.3.8"
}
My deployment is failing in the @php artisan Filament::updgrade composer script: copy(node_modules/js-confetti/dist/js-confetti.min.js): Failed to open stream: No such file or directory This is with Laravel Forge. What am I doing wrong, or what do I need to change in order for this to work? Perhaps I need to run npm install on my server?
11 Replies
mavrick
mavrick2mo ago
Try ./node_modules/js-confetti/dist/js-confetti.min.js
toeknee
toeknee2mo ago
Did you run npm install?
Jon Mason
Jon Mason2mo ago
I got it to work by adding npm install to my composer post-autoload-dump script..May need to add it somewhere else though as that script I think gets run on every deployment and I don't think I need to run npm install on every deployment. I can't just run npm install directly because the post-autoload-dump script is basically installing the project and when it doesn't complete successfully it rolls everything back, or at least that's my assumptino. it needs to be a part of the deployment. Maybe this will help some laravel forge user in the future.
toeknee
toeknee2mo ago
It depends how you are deploying, but you absolutely need to run npm install as you will miss off any added packages etc. Furthermore, you should ideally sym link your deployment for zero downtime. Ploi for isntance, installs, builds in a folder then links that to prod on successful build etc.
Jon Mason
Jon Mason2mo ago
yeah, I realized that after I said that. I have another bit I had to add to the script to run "mkdir -p resources/svg" because of the blade icons file, and I think that's one that I don't want to run on every deployment, but needs to be a part of the initial install. surprised no one has run into that before..
toeknee
toeknee2mo ago
that's usually done on npm run build usually
Jon Mason
Jon Mason2mo ago
hmmm ok, so would that typically be added to the scripts section of the composer.json file, or done as a part of the actual deployment. Like in Laravel Forge (not sure if you're familiar) they have a deployment script that gets run every time, so I have all my artisan scripts in there.
toeknee
toeknee2mo ago
Part of the deployment.... With forge it's the same, you need it as part of the deployment script
Jon Mason
Jon Mason2mo ago
Do you have any info or a link to learn about sym linking my deployment?
awcodes
awcodes2mo ago
Are you even using custom icons? If you are make sure the resources/svg directory is included in your repo and not ignored. If you aren’t then you either need to delete the blade-icons config or comment out the default set.
Jon Mason
Jon Mason2mo ago
yeah it doesn't look like I'm using any, so I guess I'll delete the config file.
Want results from more Discord servers?
Add your server
More Posts