Laravel 9 + Vite执行npm run build提示Mix manifest not found求助
解决Laravel 9生产环境
npm run build报Mix manifest not found的问题 先检查
public/mix-manifest.json文件是否存在。如果执行npm run build后未生成该文件,确认webpack.mix.js配置的输出路径是否正确,基础配置示例如下:mix.js('resources/js/app.js', 'public/js') .postCss('resources/css/app.css', 'public/css');执行缓存清理后重新构建:
# 清理Laravel缓存 php artisan cache:clear php artisan config:clear # 清理npm缓存并重装依赖 npm cache clean --force rm -rf node_modules package-lock.json npm install npm run build检查
.env文件中的APP_URL配置,生产环境需设置为实际域名,避免路径解析错误:APP_URL=https://your-production-domain.com确认Laravel Mix版本与Laravel 9兼容(Laravel 9默认适配Mix v6),若版本不匹配,重新安装对应版本:
npm install laravel-mix@^6.0.0 --save-dev若使用Git等版本控制工具,确认
public/mix-manifest.json未被.gitignore忽略,部署时需同步该文件到生产服务器。
内容的提问来源于stack exchange,提问作者Efendy zheng
相关产品推荐
相关产品推荐

