opencv4nodejs icon indicating copy to clipboard operation
opencv4nodejs copied to clipboard

Module parse failed: Unexpected character '�' (1:2)

Open intellectyxArria opened this issue 4 years ago • 2 comments

When I install opencv4nodejs in vue application and run it I get the following error message

Failed to compile.

./node_modules/opencv4nodejs/build/Release/opencv4nodejs.node 1:2
Module parse failed: Unexpected character '�' (1:2)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)

intellectyxArria avatar Aug 25 '20 05:08 intellectyxArria

  1. yarn add node-loader
  2. add below settings to webpack settings

module: { rules: [ { test: /.node$/, use: 'node-loader' } ] }

wangjing53406 avatar Aug 28 '20 07:08 wangjing53406

I had the same problem in the latest Vuecli, using the answer from upstairs, I did not have 'test'.Use: rule(/.node$/) .use('node-loader') .loader('node-loader'), and NPM install node-loader, new issue Node-loader and vue-loader conflic

minhuan520 avatar Apr 28 '21 06:04 minhuan520