deltachat / deltachat-node

Email-based instant messaging for Node.js.
GNU General Public License v3.0
45 stars 11 forks source link

Windows node npm run test #243

Closed homdx closed 5 years ago

homdx commented 5 years ago

Need help, node-gyp-build under windows and pass node tests:

c:\deltachat-node>npm install

> deltachat-node@0.39.0 install c:\deltachat-node
> node-gyp-build scripts/rebuild-core.js

'scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! deltachat-node@0.39.0 install: `node-gyp-build scripts/rebuild-core.js`

npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the deltachat-node@0.39.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\deltausr\AppData\Roaming\npm-cache\_logs\2019-02-10T10_32_
06_237Z-debug.log

**Questions:

  1. How modify packages.json and for build windows.** Now I can pass only if modify packages.json to:
    "install": "bash -c scripts/rebuild-core.js"
    log:
    [165/165] Linking target cmdline/delta.exe.
    node-gyp-build scripts/rebuild-core.js
    audited 1877 packages in 74.842s
    found 1 low severity vulnerability
    run `npm audit fix` to fix them, or `npm audit` for details

    2. For test binary whats are need?

    
    c:\Project\deltachat-node\node_modules\node-gyp-build\index.js:69
    throw new Error('No native build was found for runtime=' + runtime + ' abi=' +
    abi + ' platform=' + platform + libc + ' arch=' + arch)
    ^
Error: No native build was found for runtime=node abi=67 platform=win32glibc arc h=x64 at Function.load.path (c:\Project\deltachat-node\node_modules\node-gyp-build \index.js:69:9) at load (c:\Project\deltachat-node\node_modules\node-gyp-build\index.js:20:2 0) at Object. (c:\Project\deltachat-node\binding.js:1:768) at Module._compile (internal/modules/cjs/loader.js:734:30) at Module.replacementCompile (c:\Project\deltachat-node\node_modules\nyc\nod e_modules\append-transform\index.js:58:13) at Module._extensions..js (internal/modules/cjs/loader.js:745:10) at Object. (c:\Project\deltachat-node\node_modules\nyc\node_modul es\append-transform\index.js:62:4) at Module.load (internal/modules/cjs/loader.js:626:32) at tryModuleLoad (internal/modules/cjs/loader.js:566:12) at Function.Module._load (internal/modules/cjs/loader.js:558:3) ------------ ---------- ---------- ---------- ---------- ------------------- File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 0.59 0 0 0.61
binding.js 100 100 100 100
index.js 0.29 0 0 0.31 ... 46,747,749,753
------------ ---------- ---------- ---------- ---------- -------------------

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! deltachat-node@0.39.0 test: echo 1 && standard && echo 2 && nyc.cmd no de test/index.js npm ERR! Exit status 1

**3. How modify file binding.gyp. Like this, or another?**
  "target_name": "deltachat",
  "conditions": [
    [ "OS == 'win'", {
       "../deltachat-core/builddir/src/libdeltachat.a",
       "../deltachat-core/builddir/libs/libetpan/libetpan.a",
        "../deltachat-core/builddir/libs/netpgp/libnetpgp.a",
        "-lsasl2",
        "-lssl",
        "-lsqlite3"

}],


**4. May be need the temporary stub for test (module nodejs) binary file delta.exe?**

Structure of binary files:

c:\Project\deltachat-node\deltachat-core>dir builddir\libs\libetpan\ 10.02.2019 13:35

2b646c1@@etpan@sta 10.02.2019 13:35 2 577 424 libetpan.a c:\Project\deltachat-node\deltachat-core>dir builddir\libs\netpgp 10.02.2019 13:35 5566cff@@netpgp@sta 10.02.2019 13:35 991 config-netpgp-meson.h 10.02.2019 13:35 600 220 libnetpgp.a c:\Project\deltachat-node\deltachat-core>dir builddir\cmdline 10.02.2019 13:35 6256d62@@delta@exe 10.02.2019 13:36 4 143 274 delta.exe


5. The I `npm run dev` for deltachat-desktop, I have error:

Error: No native build was found for runtime=electron abi=69 platform=win32glibc arch=x64 at Function.load.path (C:\Project\deltachat-node\node_modules\node-gyp-build \index.js:69:9) at load (C:\Project\deltachat-node\node_modules\node-gyp-build\index.js:20:2 0) at Object. (C:\Project\deltachat-node\binding.js:1:198) at Object. (C:\Project\deltachat-node\binding.js:3:3) at Module._compile (internal/modules/cjs/loader.js:693:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:704:10) at Module.load (internal/modules/cjs/loader.js:602:32) at tryModuleLoad (internal/modules/cjs/loader.js:541:12) at Function.Module._load (internal/modules/cjs/loader.js:533:3) at Module.require (internal/modules/cjs/loader.js:640:17)



I probe install node-gyp-build globally. But error is persists (see 1 question)

Anyone wanting to help me? Or no one will help on the launch in the windows. Link to binary:

https://github.com/deltachat/deltachat-core/issues/306#issuecomment-461026117
Jikstra commented 5 years ago

It's hard for me to follow your actual steps, did you get node-gyp-build scripts/rebuild-core.js to work? The error message seems like cmd.exe somehow thinks that scripts is a command, i'm not a windows pro, maybe you need soemthing like node-gyp-build ./scripts/rebuild-core.js ? Maybe it's only a problem of how to pass path arguments on windows?

Currently I don't have a windows machine around, but will give it a try the next days. Thanks a lot for your efforts!

EDIT: Also found some install instructions for windows, maybe we need to do some more windows specific pre installation things? https://github.com/nodejs/node-gyp#on-windows

ralphtheninja commented 5 years ago

node-gyp-build scripts/rebuild-core.js

@vweevers You wouldn't know why this would be problematic on windows by any chance?

ralphtheninja commented 5 years ago

It's the following line in node-gyp-build that is being executed (@Jikstra you might be onto something with the path there)

https://github.com/prebuild/node-gyp-build/blob/master/bin.js#L60

vweevers commented 5 years ago

It's not the path, it's that you're executing scripts/rebuild-core.js rather than node scripts/rebuild-core.js.

vweevers commented 5 years ago

We need something similar to https://github.com/prebuild/prebuild/blob/3471b49372060ab60a72cee974aadfe335cb5386/util.js#L40-L46 in node-gyp-build.

ralphtheninja commented 5 years ago

Oh right, when I think of it I've seen this before. In sodium-native they do https://github.com/sodium-friends/sodium-native/blob/master/package.json#L23

homdx commented 5 years ago

Now you can reproduce build under windows: https://github.com/deltachat/deltachat-desktop/issues/606#issuecomment-465064978