尝试添加opencv时,Heroku CI构建失败,但是应用程序部署有效

时间:2018-10-08 16:35:20

标签: node.js opencv heroku cmake heroku-ci

我们正在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

这是我根据https://stackoverflow.com/a/51351494/5028937的app.json

{
  "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"
  }]
}

1 个答案:

答案 0 :(得分:0)

尝试从app.json中删除opencv buildpack,并通过heroku buildpacks:add

添加