nut-tree / nut.js

Native UI testing / controlling with node
https://nutjs.dev
2.19k stars 121 forks source link

Not valid Win32 Application error on Windows 11 Pro #525

Closed fttx closed 9 months ago

fttx commented 1 year ago

Version 2.2.0

Short overview

When starting the Electron application this error pops out

image001 (1)

Issue occurs on

Additional content

System information

image

Thanks

s1hofmann commented 1 year ago

Hi @fttx 👋

Does this happened with a plain node project as well? Which C++ runtime is installed on this machine?

raphaelmenges commented 11 months ago

As you see in the screenshot with the system information, @fttx runs Windows on ARM on SurfaceX. I guess nutjs is not yet built for that system?

s1hofmann commented 11 months ago

@raphaelmenges Windows 11 on ARM now comes with an emulation layer to support x64 applications. So far, I can confirm that this runs smooth on my Windows 11 on ARM Parallels installation on my development VM.

https://devblogs.microsoft.com/cppblog/official-support-for-arm64ec-is-here/

AmrKafina commented 10 months ago

@s1hofmann Are you able to provide any more details on how you got that working? Starting my electron app fails with this exact error on a Windows 11 Pro (arm64) machine running on my development VM, an M1 Pro. The same app builds just fine on both a windows 10 machine (x64) and my Mac machine.

I've played around with the Node version and architecture, and installed the latest Visual Studio with Arm64EC, but nothing seems to be working.

s1hofmann commented 10 months ago

@AmrKafina Do you have the Arm64 C++ runtime distributable installed as well?

AmrKafina commented 10 months ago

@s1hofmann Yup! Tried with both the ARM64 and x64 versions, same issue.

Generating a publishable release on my Windows 10 (x64) seems to be the only way I can run the app on the arm64 machine, so it looks like I'm still missing something.

s1hofmann commented 10 months ago

@AmrKafina But if your x64 build runs fine on arm, I don't see the problem?

AmrKafina commented 10 months ago

@s1hofmann The issue is that I'm not able to generate any builds directly from the arm64 machine, for development or otherwise – I'm being forced to generate the builds on a x64 machine.

The core problem still seems to be that nut-js isn't building on an arm64 based windows machine, at least not with some missing dependency.

s1hofmann commented 10 months ago

@AmrKafina Well, I can only confirm you that my Windows 11 ARM setup works flawlessly. If you want to build apps, do you have a working Visual Studio installation as well? Visual Studio Community 2022?

AmrKafina commented 10 months ago

@s1hofmann Yes, Visual Studio 2022 is installed, with almost all dependencies installed as well.

I just tried testing with a blank node project – same issue. Installing the dependency works, but running the project fails with the exact error as OP:

image

image

I really do appreciate your follow ups Simon. It seems that the issue is local to my setup, so if I figure out what the issue is I'll be sure to leave an update here.

raphaelmenges commented 10 months ago

Looks like you use nut.js in an Electron environment? Perhaps you have to exclude the nut.js module from the asar-bundling! The asar-bundling is often tricky with native libraries.

s1hofmann commented 9 months ago

Tested with node on an actual ARM device.

Fresh installation with

Microsoft Visual C++ 2022 Redistributable (Arm64) - 14.32.31332

works fine with @nut-tree/nut-js@3.1.2

SuavePirate commented 3 months ago

@AmrKafina were you able to get your build working on win-arm64? I'm still seeing the same error when trying to run a node and electron app on arm64 with nut-js 3.1.2. Latest MVC arm64 tools installed, Visual Studio 2022 installed with everything. Still no luck when running