-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrating Opencv4nodejs with Angular Electron #14
Comments
With further investigation, it seems that electron is not detected. Temporary solution: use instead of in node_modules/opencv4nodejs/lib/opencv4nodejs.js |
This also fixed all my problems when trying to webpack bundle the app for an application that wasn't electron. |
Looks like on windows below code
Same code on mac gives true. further investigation on windows Do we have any right solution? cc @justadudewhohacks and @cyluxx |
We definitely need a better way to detect, whether the module is bundled with webpack. Maybe one should simply set an enivronment variable, that we are checking for in the install script, similar to the solution proposed here. |
Hi,
I'm trying to use opencv4nodejs with Angular Electron on Windows.
It seems to build everything correctly. In the end I have a Release directory, including:
However I get the following error:
I don't really know how to proceed ?!
So here are the steps I have done so far:
Followed installation instructions for opencv4nodejs on Windows
npm install --global windows-build-tools --vs2015
npm install --save opencv4nodejs
Added Electron Rebuild
npm install --save-dev electron rebuild
"electron-rebuild": "electron-rebuild -w opencv4nodejs"
to package.jsonnpm run electron-rebuild
Added node loader
npm i node-loader
if (process.platform === 'win32' && !process.env.OPENCV4NODEJS_DISABLE_AUTOBUILD) { process.env.path += ';' + require('./node_modules/opencv-build').opencvBinDir }
to main.ts.
Added custom webpack
npm i -D @angular-devkit/build-angular @angular-builders/custom-webpack
... "build": { "builder": "@angular-builders/custom-webpack:browser", "options": { "customWebpackConfig": { "path": "./extra-webpack.config.js" }, ... }, "serve": { "builder": "@angular-builders/dev-server:generic", ... }, ...
module.exports = { module: { rules: [ { test: /\.node?$/, use: 'node-loader' } ] } };
require opencv4nodejs somewhere in the project
Thanks in advance!
The text was updated successfully, but these errors were encountered: