justadudewhohacks / npm-opencv-build

A simple script to auto build recent OpenCV + contrib version via npm
43 stars 57 forks source link

Unnecessary Rebuilds with yarn #34

Open dsanders11 opened 5 years ago

dsanders11 commented 5 years ago

This one is strange and I can't quite figure it out, but I'm seeing opencv-build needing to be rebuilt a lot as I do things with yarn. It's version 0.1.3 so it has the logic to prevent unnecessary rebuilds, and sometimes that works, but sometimes it doesn't.

@justadudewhohacks, have you tested much with yarn, or only npm? Specifically I'm using a yarn workspace where there's sub-projects. Perhaps that's causing confusion on finding the files? This is on macOS, with the latest version of yarn.

justadudewhohacks commented 5 years ago

Personally I am not using yarn, but if you can figure out the reason for that and if this is something we can fix let me know!

JCMais commented 4 years ago

Probably related https://github.com/yarnpkg/yarn/issues/932#issuecomment-385510471

Per https://github.com/yarnpkg/yarn/issues/5680#issuecomment-381775304, If the package deletes/modifies files that were bundled with it, yarn will see that the hash has changed and then will reinstall the package.

JCMais commented 4 years ago

As a workaround to this issue, I copied the opencv-build folder somewhere else and exported the following environment variables:

OPENCV4NODEJS_DISABLE_AUTOBUILD=1
OPENCV_LIB_DIR='path-to-opencv-build\\opencv\\build\\lib\\Release'
OPENCV_INCLUDE_DIR='path-to-opencv-build\\opencv\\build\\include'
OPENCV_BIN_DIR='path-to-opencv-build\\opencv\\build\\bin\\Release'

Keep in mind those paths are for Windows.