imgui-js icon indicating copy to clipboard operation
imgui-js copied to clipboard

Build broken under windows and wsl

Open apache-hb opened this issue 5 years ago • 1 comments

while following the build instructions. when running make the build errors with

npm run start-example-node

> [email protected] start-example-node /mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js
> node example/index.js

(node:13175) UnhandledPromiseRejectionWarning: ReferenceError: __dirname is not defined
    at ModuleNamespace.<anonymous> (file:///mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js/bind-imgui.js:8:1038)
    at Promise (file:///mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js/imgui.js:17:29)
    at new Promise (<anonymous>)
    at Object.<anonymous> (file:///mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js/imgui.js:16:20)
    at Generator.next (<anonymous>)
    at file:///mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js/imgui.js:9:75
    at new Promise (<anonymous>)
    at __awaiter (file:///mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js/imgui.js:5:16)
    at Object.default_1 [as default] (file:///mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js/imgui.js:15:16)
    at ModuleNamespace.<anonymous> (file:///mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js/example/main.js:22:32)
(node:13175) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:13175) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 

__dirname can be replaced by hand with process.cwd() which then reveals another error:

npm run start-example-node

> [email protected] start-example-node /mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js
> node example/index.js

{ ENOENT: no such file or directory, open '/mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js/main.js'
  Instantiating /mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js/main.js
  Loading ./main
  Error: ENOENT: no such file or directory, open '/mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js/main.js'
  originalErr:
   { Error: ENOENT: no such file or directory, open '/mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js/main.js'
     errno: -2,
     code: 'ENOENT',
     syscall: 'open',
     path: '/mnt/c/Users/ehb56/OneDrive/Documents/GitHub/Timeline/imgui-js/main.js' } }```

apache-hb avatar Dec 09 '19 23:12 apache-hb

Try it with e7b86a2e57f1b8f48f9b4d66940be64f8b9f9fa1. I've only tested on OSX, but it should also work for Windows.

flyover avatar Dec 10 '19 01:12 flyover