Closed MohammadZarifiyan closed 7 months ago
This isn't something that would happen if you use different directories for building up a new version for app like Envoyer does. To see how you can do this with something like Envoy, have a look at the Spatie website Envoy file: https://github.com/spatie/spatie.be/blob/main/Envoy.blade.php
You will still run into missing asset issues if you do symlink deployments, such as those seen in the Spatie Envoy deploy script.
The best fix for this issue is to instruct vite to not empty the output directly by using the --emptyOutDir=false
option to Vite.
npx vite build --emptyOutDir=false
Then at the end of your build script you may use our cleanup script to remove any files that are no longer needed. You should run this at the very end of your deployment script to ensure all active requests to your server for assets have completed. You might even consider putting a sleep in there to ensure the requests have finished...
npx vite build --emptyOutDir=false
sleep 1
npx clean-orphaned-assets
You will still run into missing asset issues if you do symlink deployments, such as those seen in the Spatie Envoy deploy script.
The best fix for this issue is to instruct vite to not empty the output directly by using the
--emptyOutDir=false
option to Vite.npx vite build --emptyOutDir=false
Then at the end of your build script you may use our cleanup script to remove any files that are no longer needed. You should run this at the very end of your deployment script to ensure all active requests to your server for assets have completed. You might even consider putting a sleep in there to ensure the requests have finished...
npx vite build --emptyOutDir=false sleep 1 npx clean-orphaned-assets
npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/clean-orphaned-assets - Not found npm ERR! 404 npm ERR! 404 'clean-orphaned-assets@*' is not in this registry. npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2024-04-10T13_53_18_115Z-debug-0.log
What version of the plugin are you using? You will need 1.0 or greater.
Hello. When I run the
npm run build
command, the server gives the users an 500 error and theVite Manifest Not Found
error is recorded inlaravel.log
. Please add a feature not to delete the previousmanifest.json
file from the/public
folder before thenpm run build
command is completed. It is best to add an option like--safe
for thenpm run build
to keep the previousmanifest.json
until the command is executed. For example: