基于 git 子模块的 travis 构建失败

Build on travis failing for git submodule

我有一个 angular 项目,它有一个 git 后端子模块。

当我 运行 它在我的本地机器上构建时它构建良好。但是,当我在 travis 上构建它时,它失败了。

npm ERR! enoent ENOENT: no such file or directory, open '/home/travis/build/faxad/cartify/backend/node_modules/raw-body/package.json'

npm ERR! enoent This is related to npm not being able to find a file.

在此处完成构建日志。

https://travis-ci.org/faxad/cartify/builds/378869452

仔细查看 travis 日志后,我发现 travis 发出了以下命令(当我在本地 运行 它们时也会抛出相同的错误)

git clone --branch=upgrade https://github.com/faxad/cartify.git faxad/cartify

git submodule update --init --recursive

但是,以下似乎工作正常,没有任何问题

git clone --recursive https://github.com/faxad/cartify.git

我确实设法通过先安装子模块项目的依赖项然后安装项目本身来解决问题。