Skip to content

Strange behavior with 'use strict' #1619

Closed
@th3r0b0t

Description

@th3r0b0t

Good day,
I made an addon, and when I have a index.js file inside its root directory; when I run this file to test the bindings, it works fine, but when I copy paste the addon directory to my project and require its index.js file (which its first line is 'use strict' as per examples and simply require the addon .node file and re-export it) to call its constructor (it is a context-aware addon) it crashes with an exception that has Tkrzw exception type (Tkrzw is the name of the library I'm trying to make binding for) which means constructor begins to run but then it crashes! Also before it crashes, it creates a file (which this constructor is expected to do)!
What is strange about it, is that if I run the index.js file in my addon root directory once, it no longer crashes anymore!
Then I deleted the entire project, cloned my project again, cloned my addon again and placed it again, but this time I removed 'use strict' from the top of my index.js file and it works the first time without running index.js file first!
I tested this multiple times and it was keep crashing until I figured what causes the problem!


The error it gives is: opendir: no such file (It might say it a little different I don't remember exact words but it starts with opendir: and says it cant find the file).


P.S: You can find the addon source code here: https://github.com/th3r0b0t/tkrzw-node
P.S2: Ofc I comment out everything in index.js file except for the first 3 lines: 'use strict', bindings(...) and re-export

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions