Some examples fail on msys2/mingw

Open
#445 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cmake, cpp, nodejs

Research direction

Start by reproducing the failing npm install in src/8-tooling/build_with_cmake/napi or node-addon-api under MSYS2/MinGW, using the reported cmake-js and Visual Studio errors. Compare this with the other listed cmake-js examples and identify where the toolchain is selected. Done means the affected examples install successfully with MinGW without requiring Visual Studio.

Written by the indexing model from the issue text.

Description

It is quite fortunate that most examples run, Here are all the tests:

passed: C:\a\node-addon-examples\src\1-getting-started\1_hello_world\nan
passed: C:\a\node-addon-examples\src\1-getting-started\1_hello_world\napi
passed: C:\a\node-addon-examples\src\1-getting-started\1_hello_world\node-addon-api
passed: C:\a\node-addon-examples\src\1-getting-started\1_hello_world\node-addon-api-addon-class
passed: C:\a\node-addon-examples\src\1-getting-started\2_function_arguments\nan
passed: C:\a\node-addon-examples\src\1-getting-started\2_function_arguments\napi
passed: C:\a\node-addon-examples\src\1-getting-started\2_function_arguments\node-addon-api
passed: C:\a\node-addon-examples\src\1-getting-started\3_callbacks\nan
passed: C:\a\node-addon-examples\src\1-getting-started\3_callbacks\napi
passed: C:\a\node-addon-examples\src\1-getting-started\3_callbacks\node-addon-api
passed: C:\a\node-addon-examples\src\1-getting-started\4_object_factory\nan
passed: C:\a\node-addon-examples\src\1-getting-started\4_object_factory\napi
passed: C:\a\node-addon-examples\src\1-getting-started\4_object_factory\node-addon-api
passed: C:\a\node-addon-examples\src\1-getting-started\5_function_factory\nan
passed: C:\a\node-addon-examples\src\1-getting-started\5_function_factory\napi
passed: C:\a\node-addon-examples\src\1-getting-started\5_function_factory\node-addon-api
passed: C:\a\node-addon-examples\src\1-getting-started\6_object_wrap\nan
passed: C:\a\node-addon-examples\src\1-getting-started\6_object_wrap\napi
passed: C:\a\node-addon-examples\src\1-getting-started\6_object_wrap\node-addon-api
passed: C:\a\node-addon-examples\src\1-getting-started\7_factory_wrap\nan
passed: C:\a\node-addon-examples\src\1-getting-started\7_factory_wrap\napi
passed: C:\a\node-addon-examples\src\1-getting-started\7_factory_wrap\node-addon-api
passed: C:\a\node-addon-examples\src\1-getting-started\a-first-project\node-addon-api
passed: C:\a\node-addon-examples\src\2-js-to-native-conversion\8_passing_wrapped\nan
passed: C:\a\node-addon-examples\src\2-js-to-native-conversion\8_passing_wrapped\napi
passed: C:\a\node-addon-examples\src\2-js-to-native-conversion\8_passing_wrapped\node-addon-api
passed: C:\a\node-addon-examples\src\2-js-to-native-conversion\array_buffer_to_native\node-addon-
api
passed: C:\a\node-addon-examples\src\2-js-to-native-conversion\object-template-demo\nan
passed: C:\a\node-addon-examples\src\2-js-to-native-conversion\object-template-demo\napi
passed: C:\a\node-addon-examples\src\2-js-to-native-conversion\object-wrap-demo\node-addon-api
passed: C:\a\node-addon-examples\src\2-js-to-native-conversion\typed_array_to_native\node-addon-a
pi
passed: C:\a\node-addon-examples\src\3-context-awareness\napi
passed: C:\a\node-addon-examples\src\3-context-awareness\node_10
passed: C:\a\node-addon-examples\src\5-async-work\async_pi_estimate\nan
passed: C:\a\node-addon-examples\src\5-async-work\async_pi_estimate\node-addon-api
passed: C:\a\node-addon-examples\src\5-async-work\async_work_promise\napi
passed: C:\a\node-addon-examples\src\5-async-work\async_work_promise\node-addon-api
passed: C:\a\node-addon-examples\src\5-async-work\async_work_thread_safe_function\napi
passed: C:\a\node-addon-examples\src\5-async-work\call-js-from-async-worker-execute\node-addon-ap
i
passed: C:\a\node-addon-examples\src\5-async-work\napi-asyncworker-example\node-addon-api
passed: C:\a\node-addon-examples\src\6-threadsafe-function\promise-callback-demo\node-addon-api
passed: C:\a\node-addon-examples\src\6-threadsafe-function\thread_safe_function_round_trip\napi
passed: C:\a\node-addon-examples\src\7-events\emit_event_from_cpp\node-addon-api
passed: C:\a\node-addon-examples\src\7-events\inherits_from_event_emitter\node-addon-api
failed to install:
    C:\a\node-addon-examples\src\4-references-and-handle-scope\function-reference-demo\node-addon
-api
    C:\a\node-addon-examples\src\5-async-work\async-iterator\node-addon-api
    C:\a\node-addon-examples\src\6-threadsafe-function\threadsafe-async-iterator\node-addon-api
    C:\a\node-addon-examples\src\6-threadsafe-function\thread_safe_function_counting\node-addon-a
pi
    C:\a\node-addon-examples\src\6-threadsafe-function\thread_safe_function_with_object_wrap\node
-addon-api
    C:\a\node-addon-examples\src\6-threadsafe-function\typed_threadsafe_function\node-addon-api
    C:\a\node-addon-examples\src\8-tooling\build_with_cmake\napi
    C:\a\node-addon-examples\src\8-tooling\build_with_cmake\node-addon-api
    C:\a\node-addon-examples\src\8-tooling\typescript_with_addon\node-addon-api

But everything relying on cmake-js refuses to ackownledge the existence of mingw compiler. There are many benefits to using mingw compilers. Besides, they are open source!

testing: C:\a\node-addon-examples\src\8-tooling\build_with_cmake\node-addon-api
ERR! find VS
ERR! find VS msvs_version not set from command line or npm config
ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
ERR! find VS not looking for VS2015 as it is only supported up to Node.js 18
ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
ERR! find VS
ERR! find VS **************************************************************
ERR! find VS You need to install the latest version of Visual Studio
ERR! find VS including the "Desktop development with C++" workload.
ERR! find VS For more information consult the documentation at:
ERR! find VS https://github.com/nodejs/node-gyp#on-windows
ERR! find VS **************************************************************
ERR! find VS
ERR! OMG Could not find any Visual Studio installation to use
ERR! OMG Could not find any Visual Studio installation to use
npm ERR! code 1
npm ERR! path C:\a\node-addon-examples\src\8-tooling\build_with_cmake\node-addon-api
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c cmake-js compile

npm ERR! A complete log of this run can be found in: C:\Users\topkek\AppData\Local\npm-cache\_logs\2024-03-23T14_50_50_859Z-debug-0.log
Error: Command failed: npm install
ERR! find VS
ERR! find VS msvs_version not set from command line or npm config
ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
ERR! find VS not looking for VS2015 as it is only supported up to Node.js 18
ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
ERR! find VS
ERR! find VS **************************************************************
ERR! find VS You need to install the latest version of Visual Studio
ERR! find VS including the "Desktop development with C++" workload.
ERR! find VS For more information consult the documentation at:
ERR! find VS https://github.com/nodejs/node-gyp#on-windows
ERR! find VS **************************************************************
ERR! find VS
ERR! OMG Could not find any Visual Studio installation to use
ERR! OMG Could not find any Visual Studio installation to use
npm ERR! code 1
npm ERR! path C:\a\node-addon-examples\src\8-tooling\build_with_cmake\node-addon-api
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c cmake-js compile
Dominant language
C++
Stars
2.6k
Forks
602
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nodejs/node-addon-examples

All issues in nodejs/node-addon-examples

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.