Cannot find module '../build/Release/opencv4nodejs - javascript

I am new to OpenCV and node js, trying to learn OpenCV in node js.
I came across opencv4nodejs which I found best for learning.
I have followed all steps to install OpenCV and setting environment variables for OpenCV and done npm install opencv4nodejs also. able to run Quick start code given but when I try to run example machineLearningOCR.js from examples folder I get error Error: Cannot find module '../build/Release/opencv4nodejs'
I run command node machineLearningOCR.js from cmd but getting error mentioned above on line const cv = require('../');
How to run examples given in opencv4nodejs?

If you cloned the repository and want to use the examples directly from the examples folder then you have to npm install in the root directory first to build the module.
Optionally you can npm install opencv4nodejs in any project directory, copy the examples into that directory and replace const cv = require('../'); with const cv = require('opencv4nodejs');.
You can also directly submit an issue here: https://github.com/justadudewhohacks/opencv4nodejs/issues

I had the same problem and I did solve the issue with the following steps.
First all of. I checked the npm version, for this case I recommend you updated or pass your software resources at the next version.
NodeJs 14.16.0
NodeJs version: 14.16.0. You can verify the version with this command if you had another NodeJs version installed
node --version
Npm version: 6.4.11 You need verify if you had this version installed only you will able to validate this if you have NodeJs but if you didn't have node you can install the version I recommend you
npm --version
After you set the NodeJs and npm versions you need to verify the following things
Have visual studio 2015 or latest with the development for desktop component
Have cmake program installed
Have git bash
Have Java or the language you will to work
Have the environment variables for the above programs I mentioned
Then you can try again to install open Cv
You need to reopen another or new terminal and then you will execute this command
npm install --save openc4nodejs
And then
npm install -g openc4nodejs
After than or before don't forget to install appium I recommend you 1.19.1 version
You can verify if you have appium with opencv with open Cv doctor you can run appium-doctor and check if the Open cv component are present.
For to install appium doctor you can run this command, npm install -g appium-doctor
I hope this answers will be helpful for you
Autor: Eder Carbonero

Related

NPM Install giving rollbackFailedOptional

After trying to use the Windows Powershell (as an admin), the command prompt (as an admin) and the bash CMD; I repeatedly get the following error after trying an npm install command:
npm install npm#latest -g
is the attempted command and...
[...] / rollbackFailedOptional: verb npm-session xxxxxxxxxxx
where the 'x's represent different letter and number combinations at each attempt, is the message. I am aware that this should be the first step in the installation of a package but it remains on this message for a long time and will not change.
I am trying to use the JavaScript React library, more specifically the 'create-react-app'. The npm install -g create-react-app command is also causing the error.
npm version: 6.5.0
npx version: 10.2.0
node version: 10.15.0
A solution would be greatly appreciated.
https://docs.npmjs.com/try-the-latest-stable-version-of-npm In this link there is the documentation for updating npm version for windows with a link to a tool developed by Microsoft to update npm (https://github.com/felixrieseberg/npm-windows-upgrade)
I found the solution:
As my device username has both my first and last names, with a space in between, npm was reaching errors because of this. So the solution was to uninstall node from the default location and reinstall it in a folder on my C:\ drive, where there were no files in the directory that have spaces in the names. I then changed the cache location into this same C:\ drive folder, and the problem was solved.
npm config set cache C:\NODEJS\npm-cache
(these folders must be created before you can set the config directory to these.)
For me, I ended up having to:
Uninstall Node.js
Remove the folder "nodejs" completely from C:\Program Files (or
wherever you decided to install node)
Reinstall Node.js
After that, I did not encounter [...] / rollbackFailedOptional: verb npm-session xxxxxxxxxxx anymore.
I'm not quite sure what the issue was but all suggestions I found on stack did not solve this problem for me. I hope this helps someone.
Check if you are connected to any other VPN or proxy setting. If so try to disable it or disconnect from it and then execute the npm command. It worked for me. In my case, I was using the organization laptop and was connected to external vpn network, so i disabled the vpn and tried the command and it worked.
In our case the hard disc of the nexus server (repository server) was just full. Maybe someone helps this. Before looking into other more complicated options.
for my case i uninstalled the reinstelled it and used powershell insted of cmd and it worked like a charm
First run these commands.
npm config rm proxy
npm config rm https-proxy
then run this.
npm config set registry https://registry.npmjs.org/
check if the internet is connected
and try to run the npm command which was giving the error.

How to install Node.js or npm on Xampp

I'm new, so please excuse any mistakes.
I am trying to develop a web application locally using XAMPP. I intend to deploy using a hosted web service. XAMPP was a very convenient way to get me up and programming without any fuss.
There are several github javascript libraries that look like they can only be installed with npm. Does this mean that I cannot use them? The specific one that I'm currently having a problem with is: https://github.com/selz/plyr. Or, is it possible to install npm on my XAMPP server? I have a windows machine.
Thank you very much in advance for your help.
is it possible to install npm on my XAMPP server
You will not be installing NPM on your server, you will be installing it on your machine (think of it as a regular program you install on your PC) (if your server happens to be your PC as well, then, well, you are technically installing it on your server)
In order to be able to use NPM though, since NPM is written in JavaScript, you will need to install Node.js, also on your machine.
So, head over to the Node.js site and download and install Node. NPM is included in the installer and will be installed alongside Node.
After that is done, installing NPM packages is simply a matter of heading to your desired directory and executing npm install <PACKAGE_NAME> there.
In general, XAMPP helps you with your back end. Not your front end.
Useful links:
https://docs.npmjs.com/
Does this mean that I cannot use them?
No. You can install node at https://nodejs.org and then use npm through your windows command line to install packages. To test this, just
Install NodeJS
Open Command Line
Make a new folder under your user folder called test mkdir test
cd into that folder on Windows Command Line cd test
Create a new project with npm init -y *note this creates a
package.json file for you
Now you start installing packages with npm install <package>
--save * --save saves the package info in your package.json file (recommended). There is also -g wihch means the package will
be installed globally (usually you don't want this and only want it
locally to your project).
That's how you use NodeJS. If you want to use that with XAMPP then you need to do the same thing but instead of using your user folder (C:\users\yourname) you need to use the htdocs folder of XAMPP (usually C:\xampp\htdocs)

All NPM COMMAND not working even I updated .bash_profile

I used npm for several months.
But after I install python/django and virtual environment, it's not working anymore.
The error is smething like this.
sudo npm install -g react-native-cli
module.js:341
throw err;
^Error: Cannot find module './cache/caching-client.js'
I used npm for several days but this happened first time. I searched to solve issue and found this link
Installing MEAN Stack: npm -v module.js: 338 throw err; Error: Cannot find module './cache/caching-client.js'.
But not working.
echo $NODE_PATH
/usr/local/lib/node_modules
And it occurs on all npm commands.
npm -v
npm init -y
I reinstalled the node.js again and it worked.:)
f you added React Native manually to your project, make sure you have included all the relevant dependencies that you are using, like RCTText.xcodeproj, RCTImage.xcodeproj. Next, the binaries built by these dependencies have to be linked to your app binary. Use the Linked Frameworks and Binaries section in the Xcode project settings. More detailed steps are here: Linking Libraries.
If you are using CocoaPods, verify that you have added React along with the subspecs to the Podfile. For example, if you were using the , and fetch() APIs, you would need to add these in your Podfile:
for more see this
https://www.npmjs.com/package/react-native-winjs-cli/tutorial

Error: Module did not self-register.

Server: Ubuntu server 14.04
Node: v4.2.6 LTS
npm: 1.3.10
I pullled my colleage's work from git remote. He made the node_modules as .gitignore. So I have to npm install the modules.
But after a successful install of npm. when I try to start the project using mocha. It remind me of a module didn't self-register
The error comes from the module of Bcrypt.
at bindings (/base_dir/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
I don't want to downgrade my node to 0.10, because, I can't use JS promise in that version. Somehow, JS promise is a must in my work
This problem happens mostly because you copied/cloned the repository from somewhere else, but some modules for nodeJS should be installed/registered locally on your machine, during which the happens the build process(maybe some native language like C).
and be noted that the node_modules folder should not be staged for versioning. and should be ignored by versioning tool. and the one who is trying to clone this package should build / install firstly.
I find the answer to this problem.
But plz don't devoted this just because you want.
I upgrade the NPM using
npm install npm -g.
after that, delete the node_modules folder,
then,
npm install
Everything will be good.
I had this issue while setting up my Cypress project.
After trying to delete and then reinstalling all the node-modules and upgrading everything I found out the issue was caused because Cypress uses node from its bundle version by default (which was version 8.0 in my case) , whilst the package I wanted to use required the node version to be 10 or higher.
I did have node 12.0 installed on my machine but since cypress was not using that I had to add the line shown below in the settings file (cypress.json) to set the value for 'nodeVersion' to 'system', this way you are telling cypress explicitly to use the node version installed on your machine.
Add this line to your settings file:
**"nodeVersion": "system"**

Node.js says it can't load sqlite3 module, but does anyway

I'm working with the new Node.js Tools for Visual Studio and included the sqlite3 npm module. When I call require('sqlite3') it throws the error:
Error: Cannot find module './binding\Debug\node-v11-win32-ia32\node_sqlite3.node'
Odd thing is, when I ignore the error and continue running the code, everything works fine...until the function I'm in returns; then the server crashes.
Has anyone else had this issue? I have a suspicion that it has something to do with the ./binding part, but wouldn't know where to begin in terms of finding out why.
use this:-
npm install sqlite3 --build-from-source
This is what worked for me: https://www.npmjs.com/package/sqlite3
npm install https://github.com/mapbox/node-sqlite3/tarball/master
From: https://github.com/mapbox/node-sqlite3/wiki/Building-On-Windows
Install required software:
Python 2.x: https://www.python.org/downloads/release/python-2711/
Win SDK: http://www.microsoft.com/en-us/download/details.aspx?displayLang=en&id=8279
Microsoft Visual Studio 2010+: https://www.microsoft.com/es-es/download/details.aspx?id=48217
Build:
npm install sqlite
npm install
node-gyp configure build
I got the kind of problem, my node version is v10.16.3
This globally installed sqlite3 gives error in loading by require('sqlite3')
It been solved by install a sqlite3 local to project.
$ npm install sqlite3
Note without -g option, it works for me.
It seems this is a problem with the sqlite3 npm package itself. There exists a lib\binding\Release\ folder, but not a lib\binding\Debug\ folder. I just created a copy of the Release folder, named it Debug, and all is well.
In case this above has not worked for anyone, here is what worked for me:
sudo apt install node-sqlite3
(I am using Ubuntu with Vscode as editor). It seems installing this node-sqlite3 module was the one that was recognized.
To skip searching for pre-compiled binaries, and force a build from source, use
npm install --build-from-source

Categories

Resources