This repository was archived by the owner on Oct 18, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ const { execSync } = require("child_process");
2
2
const isX64 = process . arch === "x64" ;
3
3
4
4
const install = ( pkg ) => {
5
- execSync ( `npm install ${ pkg } ` ) ;
5
+ execSync ( `npm install --no-save ${ pkg } ` ) ;
6
6
}
7
7
8
8
const packages = {
@@ -21,9 +21,18 @@ if (!process.env["OPENCV4NODEJS_PREBUILT_SKIP_DEPENDENCIES"]) {
21
21
}
22
22
23
23
const op = process . platform ;
24
+ let openCvVersion = process . env . npm_package_opencv ;
24
25
25
- console . log ( `Installing prebuilt OpenCV v${ process . env . npm_package_opencv } for plattform ${ op } ` ) ;
26
- install ( `@nut-tree/opencv-build-${ op } @${ process . env . npm_package_opencv } ` ) ;
26
+ if ( ! openCvVersion ) {
27
+ // npm 7 no longer sets fields from the package.json in process.env so lookup the package.json
28
+ // file we're running from. The environment variables are different when running locally vs
29
+ // as a dependency
30
+ const package = require ( process . env . npm_package_from || process . env . npm_package_json ) ;
31
+ openCvVersion = package . opencv ;
32
+ }
33
+
34
+ console . log ( `Installing prebuilt OpenCV v${ openCvVersion } for platform ${ op } ` ) ;
35
+ install ( `@nut-tree/opencv-build-${ op } @${ openCvVersion } ` ) ;
27
36
packages [ op ] . forEach ( pkg => {
28
37
console . log ( `Installing additional runtime dependency '${ pkg } '` ) ;
29
38
install ( pkg ) ;
You can’t perform that action at this time.
0 commit comments