I want the opencv project to be installed as node_module globally. Is that possible?
"Global" packages, installed with -g
or --global
option, are not intended to be available for require()
:
- Install it locally if you're going to
require()
it.- Install it globally if you're going to run it on the command line.
You can, however, install them locally to a parent directory. As long as the location can be found following the rules described for node_module
folders, it can be required:
For example, if the file at
'/home/ry/projects/foo.js'
calledrequire('bar.js')
, then node would look in the following locations, in this order:
/home/ry/projects/node_modules/bar.js
/home/ry/node_modules/bar.js
/home/node_modules/bar.js
/node_modules/bar.js
I have build the repo of opencv But still my project is making http call for opencv dependency.
For this, it would help if you could elaborate on how you've installed the package, including how you're specifying it as a dependency.
But, further HTTP requests should only be needed for packages upon request:
# download and build the latest version
npm install opencv
# it should remain at that version until you request an update
npm update opencv