heroku opencv4nodejs error in deployement - node.js

Error in deployment. How to solve this?
2020-11-08T09:30:21.366810+00:00 app[web.1]: Error: libopencv_core.so.3.4: cannot open shared object file: No such file or directory
2020-11-08T09:30:21.366811+00:00 app[web.1]: at Object.Module._extensions..node (internal/modules/cjs/loader.js:1003:18)
2020-11-08T09:30:21.366812+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:812:32)
2020-11-08T09:30:21.366812+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:724:14)
2020-11-08T09:30:21.366812+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:849:19)
2020-11-08T09:30:21.366813+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2020-11-08T09:30:21.366813+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/opencv4nodejs/lib/cv.js:40:8)
2020-11-08T09:30:21.366813+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:956:30)
2020-11-08T09:30:21.366814+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
2020-11-08T09:30:21.366814+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:812:32)
2020-11-08T09:30:21.366814+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:724:14)
2020-11-08T09:30:21.366814+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:849:19)
2020-11-08T09:30:21.366815+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2020-11-08T09:30:21.366815+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/opencv4nodejs/lib/opencv4nodejs.js:11:79)
2020-11-08T09:30:21.366815+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:956:30)
2020-11-08T09:30:21.366816+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
2020-11-08T09:30:21.366816+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:812:32)
The app crashes everytime showing this error. How to fix this?

Follow the below steps in order to use Open CV inside Heroku
Add heroku-buildpack-apt to your Heroku Build packs. You can go to your app's settings page and add build packs.
Create a file named Aptfile and add the following libs: libsm6, libxrender1, libfontconfig1, libice6. Follow the example below:
libsm6
libxrender1
libfontconfig1
libice6

Related

Error: Cannot find module 'polka' on Heroku

I'm trying to deploy my sapper/svelte app to heroku but getting 'Error: Cannot find module 'polka'' this error. Interesting thing is that, it was perfectly fine and working. My package.json is correct and I am not checking my modules into git either. I tried disabling caching but it is no good. Anyone have any ideas?
2020-09-16T16:04:44.083385+00:00 app[web.1]: Error: Cannot find module 'polka'
2020-09-16T16:04:44.083386+00:00 app[web.1]: Require stack:
2020-09-16T16:04:44.083386+00:00 app[web.1]: - /app/__sapper__/build/server/server.js
2020-09-16T16:04:44.083386+00:00 app[web.1]: - /app/__sapper__/build/index.js
2020-09-16T16:04:44.083387+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
2020-09-16T16:04:44.083392+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:841:27)
2020-09-16T16:04:44.083392+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1025:19)
2020-09-16T16:04:44.083393+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:72:18)
2020-09-16T16:04:44.083393+00:00 app[web.1]: at Object.<anonymous> (/app/__sapper__/build/server/server.js:4:13)
2020-09-16T16:04:44.083394+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1137:30)
2020-09-16T16:04:44.083394+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
2020-09-16T16:04:44.083394+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:985:32)
2020-09-16T16:04:44.083395+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:878:14)
2020-09-16T16:04:44.083395+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1025:19) {
2020-09-16T16:04:44.083396+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-09-16T16:04:44.083396+00:00 app[web.1]: requireStack: [
2020-09-16T16:04:44.083397+00:00 app[web.1]: '/app/__sapper__/build/server/server.js',
2020-09-16T16:04:44.083397+00:00 app[web.1]: '/app/__sapper__/build/index.js'
2020-09-16T16:04:44.083397+00:00 app[web.1]: ]
2020-09-16T16:04:44.083398+00:00 app[web.1]: }
It turns out polka's version on my package.json was set to 'next'. So I changed it to it latest stable version and deleted package.lock.json file and ran 'npm install' to create a new lock file and then pushed it to heroku. Works perfectly fine.

Unable to install npm package from github from package.json on heroku

I am using a package from github which is to be install from package.json file. But when I deploy the app on heroku, It is not able to install the package.
In package.json, I tried using different methods as below,
"sqlike": "git+https://username:access-token#github.com/vijjuu/SQLike.git"
"sqlike": "https://github.com/vijju/SQLike#master"
"sqlike": "https://github.com/vijjuu/SQLike/tarball/master"
"sqlike": "vijjuu/SQLike"
Error: Cannot find module 'SQLike'
2019-06-14T18:26:48.223971+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
2019-06-14T18:26:48.223973+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:562:25)
2019-06-14T18:26:48.223975+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:690:17)
2019-06-14T18:26:48.223976+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2019-06-14T18:26:48.223977+00:00 app[web.1]: at Object. (/app/server.js:2:18)
2019-06-14T18:26:48.223979+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:776:30)
2019-06-14T18:26:48.223980+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2019-06-14T18:26:48.223982+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2019-06-14T18:26:48.223983+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2019-06-14T18:26:48.223985+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
1) Your exporting your sql like but not importing it anywhere.
2) You don't have a server like ( node ) to run it on Heroku.

Angular 2 - Cannot read property 'AssetUrl' of undefined

I am new at angular2 and material-design. I am trying to use them togeather.
I cloned this material2-app, which is application code based on angular2 and material2 and run npm install.
When I run this command npm start to start a server. I got this error. Any Leads ?
Error-from-terminal
> m2-app#0.0.0 start /home/adil/Code/AngularJS.2/a-simple-app/material2-app
> ng serve
Cannot read property 'AssetUrl' of undefined
TypeError: Cannot read property 'AssetUrl' of undefined
at Object.<anonymous> (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/#angular/compiler-cli/src/private_import_compiler.js:10:51)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/#angular/compiler-cli/src/reflector_host.js:13:33)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/#angular/compiler-cli/src/path_mapped_reflector_host.js:16:24)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/#angular/compiler-cli/src/codegen.js:16:36)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/#angular/compiler-cli/index.js:12:17)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/#ngtools/webpack/src/plugin.js:6:18)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/#ngtools/webpack/src/index.js:6:10)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/angular-cli/models/webpack-build-typescript.js:5:17)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/angular-cli/models/webpack-config.js:2:34)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/angular-cli/tasks/build-webpack.js:6:24)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/angular-cli/commands/build.js:3:23)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Class.module.exports.includedCommands (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/angular-cli/addon/index.js:21:16)
at /home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/angular-cli/lib/models/project.js:392:61
at Array.forEach (native)
at Project.addonCommands (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/angular-cli/lib/models/project.js:391:15)
at Project.eachAddonCommand (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/angular-cli/lib/models/project.js:426:30)
at module.exports (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/angular-cli/lib/cli/lookup-command.js:33:13)
at CLI.<anonymous> (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/angular-cli/lib/cli/cli.js:34:26)
at tryCatch (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/rsvp/dist/rsvp.js:538:12)
at invokeCallback (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/rsvp/dist/rsvp.js:553:13)
at publish (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/rsvp/dist/rsvp.js:521:7)
at flush (/home/adil/Code/AngularJS.2/a-simple-app/material2-app/node_modules/rsvp/dist/rsvp.js:2373:5)
at nextTickCallbackWith0Args (node.js:419:9)
at process._tickCallback (node.js:348:13)
npm ERR! Linux 4.4.0-45-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! m2-app#0.0.0 start: `ng serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the m2-app#0.0.0 start script 'ng serve'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the m2-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ng serve
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs m2-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls m2-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/adil/Code/AngularJS.2/a-simple-app/material2- app/npm-debug.log
I faced similar issue. It seems to problem with new compiler-cli of Angular. I resolved it by adding following in devDependencies in package.json
"#angular/compiler-cli": "^2.0.0"
After doing npm install again error was gone.
you should add ng2material in system.js
as
var map = {
'ng2-material': 'node_modules/ng2-material',
};
var packages = {
'ng2-material': {defaultExtension: 'js'},
};

rawmemchr: symbol not found in nodegit with docker

When I run the server in the Docker container, everything works fine until I include the line nodegit = require 'nodegit'. If NodeGit is required, on docker-compose up I get the following error:
Error: Error relocating
/usr/myContainer/node_modules/nodegit/build/Release/nodegit.node:
__rawmemchr: symbol not found
I tried NodeGit v.0.12.1 (the latest version) and v.0.11.0.
Without Docker, NodeGit works fine in the same project.
I am new to Docker and virtual machines generally. Any advice on how to troubleshoot this would really help. Thanks!
Update: here are the logs of my container:
[00:22:03] Requiring external module coffee-script/register
[00:22:04] Using gulpfile /usr/lada/gulpfile.coffee
[00:22:04] Starting 'lada-up'...
[00:22:04] Finished 'lada-up' after 23 ms
livereload[tiny-lr] listening on 35729 ...
Error: Error relocating /usr/lada/node_modules/nodegit/build/Release/nodegit.node: __rawmemchr: symbol not found
at Error (native)
at Object.Module._extensions..node (module.js:440:18)
at Module.load (/usr/lib/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/usr/lada/node_modules/nodegit/lib/nodegit.js:9:12)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (/usr/lib/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/usr/lada/app/post.coffee:1:11)
at Object.<anonymous> (/usr/lada/app/post.coffee:1:1)
at Module._compile (module.js:413:34)
at Object.loadFile (/usr/lib/node_modules/coffee-script/lib/coffee-script/register.js:16:19)
at Module.load (/usr/lib/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/usr/lada/app/index.coffee:8:6)
at Object.<anonymous> (/usr/lada/app/index.coffee:1:1)
at Module._compile (module.js:413:34)
at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:134:23)
at compileScript (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:224:29)
at compilePath (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:174:14)
at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:98:20)
at Object.<anonymous> (/usr/lib/node_modules/coffee-script/bin/coffee:7:41)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:142:18)
at node.js:939:3

morgan won't load module 'debug' on Heroku

I have this in my express settings
var morgan = require("morgan");
app.use(morgan("dev"));
This works on my development macine, but crashes when I deploy to Heroku:
heroku[web.1]: Starting process with command `node server.js`
app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
app[web.1]: Recommending WEB_CONCURRENCY=1
app[web.1]: at Module._compile (module.js:460:26)
app[web.1]: at Object.<anonymous> (/app/node_modules/morgan/index.js:16:13)
app[web.1]: at Function.Module._load (module.js:310:12)
app[web.1]: module.js:338
app[web.1]: at Module.require (module.js:365:17)
app[web.1]: throw err;
app[web.1]: at Module.load (module.js:355:32)
app[web.1]: at Object.Module._extensions..js (module.js:478:10)
app[web.1]: ^
app[web.1]: at Module.require (module.js:365:17)
app[web.1]: Error: Cannot find module 'debug'
app[web.1]: at Function.Module._resolveFilename (module.js:336:15)
app[web.1]: at Function.Module._load (module.js:278:25)
app[web.1]: at require (module.js:384:17)
heroku[web.1]: State changed from starting to crashed
I can replicate the problem by running node from the Heroku CLI, and trying to require morgan. Anyone have an idea what I'm doing wrong?
> var morgan = require("morgan");
Error: Cannot find module 'debug'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/app/node_modules/morgan/index.js:16:13)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
Line 16 of index.js reads var debug = require('debug')('morgan').
The debug module does lack an index.js, but has this in its package.json instead
"main": "./node.js",
"browser": "./browser.js",
"component": {
"scripts": {
"debug/index.js": "browser.js",
"debug/debug.js": "debug.js"
}
},
Turns out was something to do with an out-of-date package and updating to latest enabled me to progress

Resources