Laravel 在生产服务器上通过 composer 安装 Nova 失败

Laravel Nova installation via composer fails on production server

我已将 Laravel Nova 添加到我们的应用程序并购买了许可证。在本地服务器上一切正常。但是,当我尝试将更新后的应用程序部署到我们的 linux 服务器和 运行 composer update 时,它说:

Failed to download laravel/nova from dist: /var/www/{myPath} does not exist and could not be created.
    Now trying to download from source

Syncing laravel/nova (3.29.0) into cache

Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
Head to https://github.com/settings/tokens/new It will be stored in "/var/www/{myPath}"

所以我创建了一个 GitHub 令牌 并将 Laravel Nova 凭据添加到 auth.json 文件也在服务器上。一切都应该是正确的,并且正如我之前所说,它正在处理本地副本。但是,我收到以下错误:

[RuntimeException]                                                                                                                                    
Failed to execute git clone --mirror -- 'git@github.com:laravel/nova.git' '/var/www/{myPath}/.cache/composer/vcs/git-github.com-laravel-nova.git/'                                                                                                                                              
                                                                                                                                                        
Cloning into bare repository '/var/www/{myPath}/.cache/composer/vcs/git-github.com-laravel-nova.git'...                                     
ERROR: Repository not found.                                                                                                                          
fatal: Could not read from remote repository.                                                                                                         
                                                                                                                                                        
Please make sure you have the correct access rights                                                                                                   
and the repository exists.      

我该如何解决这个问题?

删除 /vendor 目录和 composer.lock 文件以及 运行 composer install --optimize-autoloader --no-dev 解决了问题。

我遇到了类似的问题,最终找出了原因,归因于 laravel/nova:3.29。对 3.30 的小升级为我解决了这个问题,而不必删除整个 composer.lock 文件,因为它也会更新一些其他包。