【问题标题】:Laravel Nova installation via composer fails on production server通过作曲家安装 Laravel Nova 在生产服务器上失败
【发布时间】:2021-10-21 21:56:52
【问题描述】:

我已将 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.      

我该如何解决这个问题?

【问题讨论】:

  • 为什么在部署过程中需要运行composer update?这可能会导致在不同的系统上安装不同的库,这是您应该始终避免的事情
  • 另外,/var/www/{myPath} does not exist and could not be created 听起来很奇怪——你有什么办法解决这个问题?该路径是否可能丢失,或者是否配置了错误的权限,以至于您的部署过程无法写入该路径?
  • @NicoHaase:我知道composer update做了什么。部署在我们的公共 DevServer 上进行。由于隐私原因,{myPath} 只是真实路径的占位符。配置没有问题。这都是关于 Laravel Nova 资源的。

标签: laravel composer-php laravel-nova


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2021-10-05
    • 2017-02-14
    • 1970-01-01
    • 1970-01-01
    • 2013-12-25
    • 2013-07-10
    • 2018-06-22
    • 2016-02-07
    相关资源
    最近更新 更多