# Opencv.js cannot be compiled on Windows systems

**URL:** <https://forum.opencv.org/t/opencv-js-cannot-be-compiled-on-windows-systems/23334>\
**Category:** Uncategorized\
**Tags:** opencvjs, build\
**Created:** [July 26, 2025, 9:13am UTC](https://forum.opencv.org/t/opencv-js-cannot-be-compiled-on-windows-systems/23334 "2025-07-26T09:13:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jianxingyaoyjjwxy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/jianxingyaoyjjwxy/32/13561_2.png) [@jianxingyaoyjjwxy](https://forum.opencv.org/u/jianxingyaoyjjwxy)\
**Post date:** [July 26, 2025, 9:13am UTC](https://forum.opencv.org/t/opencv-js-cannot-be-compiled-on-windows-systems/23334/1 "2025-07-26T09:13:52Z")

</div>

I downloaded the latest versions of Emscripten, Python, Ninja, CMake, and OpenCV, and ran the following command

```auto
emcmake python ./opencv/platforms/js/build_js.py build_js

```

Error

```auto
configure: python ./opencv/platforms/js/build_js.py build_js '-DCMAKE_TOOLCHAIN_FILE=E:\emsdk\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake' -DCMAKE_CROSSCOMPILING_EMULATOR=E:/emsdk/node/22.16.0_64bit/bin/node.exe -G Ninja
EMSCRIPTEN/EMSDK environment variable is not available. Please properly activate Emscripten SDK and consider using 'emcmake' launcher
usage: build_js.py [-h] [--opencv_dir OPENCV_DIR] [--emscripten_dir EMSCRIPTEN_DIR] [--build_wasm] [--disable_wasm]
                   [--disable_single_file] [--threads] [--simd] [--build_test] [--build_perf] [--build_doc]
                   [--build_loader] [--clean_build_dir] [--skip_config] [--config_only] [--enable_exception]
                   [--cmake_option CMAKE_OPTION] [--build_flags BUILD_FLAGS] [--build_wasm_intrin_test]
                   [--config CONFIG] [--webnn]
                   build_dir
build_js.py: error: unrecognized arguments: -G Ninja
emcmake: error: 'python ./opencv/platforms/js/build_js.py build_js '-DCMAKE_TOOLCHAIN_FILE=E:\emsdk\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake' -DCMAKE_CROSSCOMPILING_EMULATOR=E:/emsdk/node/22.16.0_64bit/bin/node.exe -G Ninja' failed (returned 2)

```

It seems the issue is related to Emscripten not having the environment set up correctly, but my environment passed the verification from Emscripten’s official documentation. I hope someone can help.

---

<div class="post-metadata">

**Author:** ![jianxingyaoyjjwxy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/jianxingyaoyjjwxy/32/13561_2.png) [@jianxingyaoyjjwxy](https://forum.opencv.org/u/jianxingyaoyjjwxy)\
**Post date:** [July 26, 2025, 12:34pm UTC](https://forum.opencv.org/t/opencv-js-cannot-be-compiled-on-windows-systems/23334/3 "2025-07-26T12:34:14Z")

</div>

Now my error has come to

```auto
configure: python ../opencv/platforms/js/build_js.py build_js "--cmake_option=-G MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=E:\emsdk\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=E:/emsdk/node/22.16.0_64bit/bin/node.exe -G "MinGW Makefiles"
usage: build_js.py [-h] [--opencv_dir OPENCV_DIR] [--emscripten_dir EMSCRIPTEN_DIR] [--build_wasm] [--disable_wasm]
                   [--disable_single_file] [--threads] [--simd] [--build_test] [--build_perf] [--build_doc]
                   [--build_loader] [--clean_build_dir] [--skip_config] [--config_only] [--enable_exception]
                   [--cmake_option CMAKE_OPTION] [--build_flags BUILD_FLAGS] [--build_wasm_intrin_test]
                   [--config CONFIG] [--webnn]
                   build_dir
build_js.py: error: unrecognized arguments: -G MinGW Makefiles
emcmake: error: 'python ../opencv/platforms/js/build_js.py build_js "--cmake_option=-G MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=E:\emsdk\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=E:/emsdk/node/22.16.0_64bit/bin/node.exe -G "MinGW Makefiles"' failed (returned 2)

```

---

<div class="post-metadata">

**Author:** ![sturkmen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/sturkmen/32/13_2.png) [@sturkmen](https://forum.opencv.org/u/sturkmen)\
**Post date:** [July 30, 2025, 11:39pm UTC](https://forum.opencv.org/t/opencv-js-cannot-be-compiled-on-windows-systems/23334/4 "2025-07-30T23:39:46Z")

</div>

there is no support compiling OpenCV.js on Windows. i used WSL [Install WSL | Microsoft Learn](https://learn.microsoft.com/en-us/windows/wsl/install) and followed the instructions on [OpenCV: Build OpenCV.js](https://docs.opencv.org/4.x/d4/da1/tutorial_js_setup.html)
