我们正在 Heroku 上构建一个 API,并且一直在快速推进,直到我们最近通过https://www.npmjs.com/package/opencv4nodejs添加了 opencv
在开发环境中运行良好,如果我们使用 git push 进行部署,但如果我们尝试使用 Heroku CI 构建失败。
我尝试过使用和不使用 OPENCV4NODEJS_DISABLE_AUTOBUILD 标志,但均未成功。此外,如果我更改节点/npm 版本,部署似乎也会失败(不确定是否相关)。
-----> Fetching starkast/cmake buildpack...
buildpack downloaded
-----> Fetching https://github.com/onboardiq/heroku16-buildpack-opencv3.git buildpack...
buildpack downloaded
-----> Fetching heroku/nodejs buildpack...
buildpack downloaded
-----> CMake app detected
-----> Installing CMake version: 3.8.1
Downloading binary distribution
Verifying download
gpg: new configuration file `/app/.gnupg/gpg.conf' created
gpg: WARNING: options in `/app/.gnupg/gpg.conf' are not yet active during this run
...
-----> Creating environment variables.
cp: '/app/.heroku/cmake' and '/app/.heroku/cmake' are the same file
cp: '/app/.heroku/vendor' and '/app/.heroku/vendor' are the same file
cp: '/app/.profile.d/opencv.sh' and '/app/.profile.d/opencv.sh' are the same file
cp: '/app/.profile.d/sprettur.sh' and '/app/.profile.d/sprettur.sh' are the same file
-----> Node.js app detected
bash: /tmp/buildpacks/9bc901852117be66dc68068325767a3d2b8ee44665d854d905a7c1524cf353680e0850b0ce15a6f75047288aa1c0ddbec0154cab65cd63fa33e54f02a7b570b6/export: No such file or directory
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=false
NODE_VERBOSE=false
NODE_ENV=test
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 8.11.4
engines.npm (package.json): 5.6.0
Resolving node version 8.11.4...
Downloading and installing node 8.11.4...
npm 5.6.0 already installed with node
-----> Building dependencies
Installing node modules (package.json + package-lock)
> opencv-build@0.0.15 install /app/node_modules/opencv-build
> node ./install.js
info install if you want to use an own OpenCV installation set OPENCV4NODEJS_DISABLE_AUTOBUILD
info install library dir does not exist: /app/node_modules/opencv-build/opencv/build/lib
info install running install script...
ERR! Error: Command failed: cmake --version
/bin/sh: 1: cmake: not found
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! opencv-build@0.0.15 install: `node ./install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv-build@0.0.15 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.VAgJQ/_logs/2018-10-08T16_13_39_048Z-debug.log
-----> Build failed
这是我的 app.json 根据https://stackoverflow.com/a/51351494/5028937
{
"name": "myappname",
"scripts": {},
"env": {
"GOOGLE_MAPS_API_KEY": {
"required": true
},
"DATABASE_URL": {
"required": true
},
"OPENCV4NODEJS_DISABLE_AUTOBUILD": {
"required": true,
"value": 1
},
"OVERPASS_URL": {
"required": true
}
},
"formation": {
"web": {
"quantity": 1
}
},
"stack": "heroku-16",
"buildpacks": [{
"url": "starkast/cmake"
}, {
"url": "https://github.com/onboardiq/heroku16-buildpack-opencv3.git"
}, {
"url": "heroku/nodejs"
}]
}