how do i fix this node_dlang error?

Jack jckj33 at gmail.com
Sun Jun 6 15:42:55 UTC 2021


On Sunday, 6 June 2021 at 06:10:18 UTC, Mike Parker wrote:
> On Sunday, 6 June 2021 at 04:25:39 UTC, Jack wrote:
>> I'm trying to use the node_dlang pakckage but the code example 
>> from [this 
>> repo](https://github.com/NotSpooky/node_dlang/tree/v0.4.11/examples) isn't working
>>
>> the command ```dub build``` is fine but ```node example.js``` 
>> retuns an error saying the module.node is not a valid win32 
>> application. How do I fix this?
>>
>> [1]: 
>> https://github.com/NotSpooky/node_dlang/tree/v0.4.11/examples
>
> Looking at node_dlang's dub.json, it's building a DLL then 
> renaming it to module.node. The JS script then causes node to 
> load the DLL.
>
> So I expect this error may be related to a 32-bit vs. 64-bit 
> issue. I assume you are on 64-bit Windows, in which case recent 
> versions of dub compile as 64-bit by default. So if that's the 
> case, and your installation of node is 32-bit, you would see 
> this error. Ditto when you're loading a 32-bit DLL in a 64-bit 
> process.

the npm was 32bit so the switch to 64bit worked then npm 
example.js ran file but electron requires a 32bit module, so I 
need to switch back to npm 32bit. Now, I can't build the example 
from node_dlang with --arch=x86, returns the error:

command:

```$ dub --arch=x86```

output:

```
Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for 
x86, x86_omf.
node_dlang 0.4.11: building configuration "node_dlang_windows"...
..\..\AppData\Local\dub\packages\node_dlang-0.4.11\node_dlang\source\node_dlang.d(137,11): Error: none of the overloads of `this` are callable using argument types `(string, string, ulong, Throwable)`, candidates are:
C:\D\dmd2\windows\bin\..\..\src\druntime\import\object.d(2440,30):        `object.Exception.this(string msg, string file = __FILE__, uint line = cast(uint)__LINE__, Throwable nextInChain = null)`
C:\D\dmd2\windows\bin\..\..\src\druntime\import\object.d(2445,30):        `object.Exception.this(string msg, Throwable nextInChain, string file = __FILE__, uint line = cast(uint)__LINE__)`
C:\D\dmd2\windows\bin\dmd.exe failed with exit code 1.
```


More information about the Digitalmars-d-learn mailing list