You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using yarn and I noticed that whenever I add or remove a package, yarn resets the node_modules package states. This results in the loss of release files and opencv4nodejs requires rebuilding everytime a package install takes place.
Even if I manually copy over the opencv4nodejs.node file to OPENCV_BIN_DIR (as this is the directory the getOpenCV function checks for), it does not work because the function does not look for the correct file path.
From what I could decipher, the getOpenCV function uses the below logic:
Looks for Debug/opencv4nodejs.node inside node_modules/@u4/opencv4nodejs/build/, then looks for Release/opencv4nodejs.node inside the same folder
In case the Release build is not found, it checks for process.env.path - this would work only on windows, I think this should be process.env.PATH:
logDebug('require','there is no path environment variable, skipping...')
throwerr
}
On my linux machine, this is the exact block the execution ends up in, and does not proceed.
Next. it tries to add OPENCV_BIN_DIR to process.env.path, I think path should be contactenated with the colon operator on linux and semicolon on windows (unless this part is meant only for windows):
After path modification, it tries to require the exact same release build path it did in Step 1, without any modification to the path - This is guaranteed to fail, are we trying to look for OPENCV_BIN_DIR/opencv4nodejs.node instead of node_modules/@u4/opencv4nodejs/build/Release/opencv4nodejs.node at this point?
I am not sure if the above logic is written as it was meant to be. Also, I would highly recommend making the output directory for node-gyp used within the package configurable via an environment variable and using the same environment variable to check for the build files existence in getOpenCV.
Kindly look into this.
The text was updated successfully, but these errors were encountered:
Hi Uriel,
Great work with the library!
I am using yarn and I noticed that whenever I add or remove a package, yarn resets the node_modules package states. This results in the loss of release files and opencv4nodejs requires rebuilding everytime a package install takes place.
Even if I manually copy over the opencv4nodejs.node file to OPENCV_BIN_DIR (as this is the directory the getOpenCV function checks for), it does not work because the function does not look for the correct file path.
From what I could decipher, the getOpenCV function uses the below logic:
Looks for
Debug/opencv4nodejs.node
insidenode_modules/@u4/opencv4nodejs/build/
, then looks forRelease/opencv4nodejs.node
inside the same folderIn case the Release build is not found, it checks for
process.env.path
- this would work only on windows, I think this should beprocess.env.PATH
:opencv4nodejs/lib/cvloader.ts
Lines 65 to 68 in db49b49
Next. it tries to add OPENCV_BIN_DIR to
process.env.path
, I think path should be contactenated with the colon operator on linux and semicolon on windows (unless this part is meant only for windows):opencv4nodejs/lib/cvloader.ts
Line 77 in db49b49
After path modification, it tries to require the exact same release build path it did in Step 1, without any modification to the path - This is guaranteed to fail, are we trying to look for
OPENCV_BIN_DIR/opencv4nodejs.node
instead ofnode_modules/@u4/opencv4nodejs/build/Release/opencv4nodejs.node
at this point?I am not sure if the above logic is written as it was meant to be. Also, I would highly recommend making the output directory for node-gyp used within the package configurable via an environment variable and using the same environment variable to check for the build files existence in getOpenCV.
Kindly look into this.
The text was updated successfully, but these errors were encountered: