justadudewhohacks/opencv4nodejs

Can't resolve '../build/Release/opencv4nodejs.node'

Danendra10 opened this issue · 1 comments

I'm using laravel-mix with opencv4nodejs for detection purposes

it returns

ERROR in ./node_modules/opencv4nodejs/lib/opencv4nodejs.js 11:29-75
Module not found: Error: Can't resolve '../build/Release/opencv4nodejs.node' in '/Users/danendracleveroananda/Documents/Projects/final-detector/node_modules/opencv4nodejs/lib'

this is my package.json

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production"
    },
    "devDependencies": {
        "@popperjs/core": "^2.10.2",
        "axios": "^0.21",
        "bootstrap": "^5.1.3",
        "laravel-mix": "^6.0.6",
        "lodash": "^4.17.19",
        "postcss": "^8.1.14",
        "resolve-url-loader": "^5.0.0",
        "sass": "^1.32.11",
        "sass-loader": "^11.0.1"
    },
    "dependencies": {
        "media-device": "^1.1.8",
        "opencv4nodejs": "^5.6.0",
        "tesseract.js": "^4.0.2"
    },
    "opencv4nodejs": {
        "disableAutoBuild": 1,
        "opencvIncludeDir": "/opt/homebrew/Cellar/opencv/4.7.0_2/include",
        "opencvLibDir": "/opt/homebrew/Cellar/opencv/4.7.0_2/lib",
        "opencvBinDir": "/opt/homebrew/Cellar/opencv/4.7.0_2/bin",
        "opencvLibs": [
            "opencv_core",
            "opencv_imgproc",
            "opencv_imgcodecs",
            "opencv_highgui",
            "opencv_videoio",
            "opencv_video",
            "opencv_objdetect",
            "opencv_features2d",
            "opencv_calib3d",
            "opencv_ml",
            "opencv_flann",
            "opencv_dnn",
            "opencv_photo",
            "opencv_stitching",
            "opencv_superres",
            "opencv_videostab",
            "opencv_aruco",
            "opencv_bgsegm",
            "opencv_bioinspired",
            "opencv_ccalib",
            "opencv_datasets",
            "opencv_dpm",
            "opencv_face",
            "opencv_freetype",
            "opencv_fuzzy",
            "opencv_hdf",
            "opencv_hfs",
            "opencv_img_hash",
            "opencv_line_descriptor",
            "opencv_optflow",
            "opencv_phase_unwrapping",
            "opencv_plot",
            "opencv_reg",
            "opencv_rgbd",
            "opencv_saliency",
            "opencv_sfm",
            "opencv_shape",
            "opencv_stereo",
            "opencv_structured_light",
            "opencv_surface_matching",
            "opencv_text",
            "opencv_tracking",
            "opencv_xfeatures2d",
            "opencv_ximgproc",
            "opencv_xobjdetect",
            "opencv_xphoto"
        ]
    }
}

this is my webpack

const mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .sourceMaps();


mix.webpackConfig({
    resolve: {
        fallback: {
            path: require.resolve("path-browserify"),
            fs: false,
            os: false,
            child_process: false
        }
    }
});

and this is my bootstrap.js

window._ = require('lodash');

try {
    require('bootstrap');
} catch (e) {}

const mediaDevices = require('media-device');
window.mediaDevices = mediaDevices;
const Tessaract = require('tesseract.js');
window.Tessaract = Tessaract;
const cv = require('opencv4nodejs');
window.cv = cv;
window.axios = require('axios');

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

/**
 * Echo exposes an expressive API for subscribing to channels and listening
 * for events that are broadcast by Laravel. Echo and event broadcasting
 * allows your team to easily build robust real-time web applications.
 */

// import Echo from 'laravel-echo';

// window.Pusher = require('pusher-js');

// window.Echo = new Echo({
//     broadcaster: 'pusher',
//     key: process.env.MIX_PUSHER_APP_KEY,
//     cluster: process.env.MIX_PUSHER_APP_CLUSTER,
//     forceTLS: true
// });

Try with @u4/opencv4nodejs; this project is no more active.