npm install @u4/opencv4nodejs 报错
-
报错核心提示:
npm error gyp: Call to 'node ./bin/install.js OPENCV4NODEJS_DEFINES' returned exit status 1 while in binding.gyp. while trying to load binding.gyp -
说明:
远程下载,网络不稳定 -
解决方案:
# 关闭自动下载opencv set OPENCV4NODEJS_DISABLE_AUTOBUILD=1 # 查看环境变量是否存在 # set OPENCV4NODEJS_DISABLE_AUTOBUILD # 清除环境变量 # set OPENCV4NODEJS_DISABLE_AUTOBUILD=
-
报错核心提示:
npm error Error: OPENCV_BIN_DIR must be define if auto-build is disabled, and autodetection failed npm error OPENCV_INCLUDE_DIR must be define if auto-build is disabled, and autodetection failed npm error OPENCV_LIB_DIR must be define if auto-build is disabled, and autodetection failed -
说明:
使用本地opencv,需要手动指定环境变量 OPENCV_INCLUDE_DIR、OPENCV_LIB_DIR、OPENCV_BIN_DIR的路径 -
解决方案:
# 环境变量设置 set OPENCV_INCLUDE_DIR=E:\opencv-4.5.5-vc16\build\include set OPENCV_LIB_DIR=E:\opencv-4.5.5-vc16\build\x64\vc16\lib set OPENCV_BIN_DIR=E:\opencv-4.5.5-vc16\build\x64\vc16\bin
注意:
- set 是在当前终端设置临时变量的windows写法,终端关闭后,设置就会失效
永久生效方案是:直接在环境变量创建变量和值 - 环境变量设置,在webstorm的终端并不是实时的,需要重启电脑后,webstrom才能识别新增的环境变量
- 需要在cmd环境处理,而不是powerShell,需要查看webstrom默认使用的是哪个终端类型

被折叠的 条评论
为什么被折叠?



