xxxxxxxx-Air:OutBuy xxxxxxxx$ lean info
[INFO] Retrieving user info from region: cn
[INFO] Retrieving app info ...
[INFO] Current region:  cn User: tonycph (tonyxxxxx@gmail.com)
[INFO] Current region: cn App: OutBuy (IDX4LztPPtMsBK7gim8UJo7s-gzGzoHsz)
[INFO] Current group: dyhkbuycn
xxxxxxxx-Air:OutBuy xxxxxxxx$ cat public/vendor/index.html 
<h1>hello</h1>
xxxxxxxx-Air:OutBuy xxxxxxxx$ lean deploy
[INFO] Current CLI tool version:  0.21.0
[INFO] Retrieving app info ...
[INFO] Preparing to deploy OutBuy(IDX4LztPPtMsBK7gim8UJo7s-gzGzoHsz) to region: cn group: dyhkbuycn staging
[INFO] PHP runtime detected
[INFO] Uploading file 3.49 MiB / 3.49 MiB [=========================] 100.00% 6s
[REMOTE] Building 20200307-184355
[REMOTE] Downloading source code ...
[REMOTE] Unpacking source code ...
[REMOTE] Runtime: php
[REMOTE] Downloading and installing dependencies ...
[REMOTE] Storing version to registry(0B) ...
[REMOTE] Version 20200307-184355 build finished
[REMOTE] Deploying 20200307-184355 to dyhkbuycn-staging
[REMOTE] Creating new instance ...
[REMOTE] Starting new instance ...
[REMOTE] [PHP] Using PHP 7.2.28, PHP SDK 0.11.0
[REMOTE] Instance started: {"runtime":"php-7.2.28-2+ubuntu16.04.1+deb.sury.org+2","version":"0.11.0"}
[REMOTE] Deploy finished: 1 instances deployed
[INFO] Deleting temporary files
xxxxxxxx-Air:OutBuy xxxxxxxx$ lean publish
[INFO] Current CLI tool version:  0.21.0
[INFO] Retrieving app info ...
[INFO] Deploying OutBuy(IDX4LztPPtMsBK7gim8UJo7s-gzGzoHsz) to region: cn group: dyhkbuycn production
[REMOTE] Deploying 20200307-184355 to dyhkbuycn1
[REMOTE] Creating new instance ...
[REMOTE] Starting new instance ...
[REMOTE] Instance started: {"runtime":"php-7.2.28-2+ubuntu16.04.1+deb.sury.org+2","version":"0.11.0"}
[REMOTE] Deploy finished: 1 instances deployed

lean publish后在https://域名.leanapp.cn/vendor/index.html显示不存在

发现将 vendor 变为 vendor_template 就可以了。是不是 vendor 这个 directory 跟其他有冲突?

是不是 vendor 这个 directory 跟其他有冲突

有可能。云引擎命令行工具(lean-cli)是用 Go 写的,Go 语言里 vendor 是保留目录。具体需要调查一下,有进展会回复这个帖子。

应该是你在 .leanignore 中忽略了 vendor 目录,所以命令行工具不会上传。如果你没有 .leanignore,命令行工具会自动生成一个默认的,里面会有 vendor。

1 人赞了这个帖子.

确实像 jysperm 说的那样,是因为命令行工具为 PHP 项目默认生成的 .leanignore 会忽略 vendor 目录。原因是 PHP 项目的包管理工具 composer 会把依赖安装在 vendor 目录下,所以默认生成的 .leanignore 会忽略 vendor 目录,避免把依赖上传到云引擎环境,浪费流量。理论上说, public 目录下虽然有 vendor 目录但并没有 composer.json,所以这种情况下vendor 目录不归 composer 管理,不应该忽略,但是命令行工具的默认情况下也一并忽略了(这样实现起来比较简单)。建议避免在项目中自行创建 vendor 目录。

1 人赞了这个帖子.

明白。谢谢您们的解释