Neon: windows 10 build fails due to neon / node-gyp

Created on 10 Aug 2018  路  6Comments  路  Source: neon-bindings/neon

When I try to compile my node module on windows 10, I get this error output:
``` error: failed to run custom build command forneon-runtime v0.2.0 process didn't exit successfully:C:\Users\joey\accept\foonative\target\release\buildneon-runtime-86fadbd9e829adf1\build-script-build` (exit code: 101)
--- stdout
'Skipping node-gyp installation as part of npm install.'
up to date in 0.586s
cargo:node_arch=x64

--- stderr
thread 'main' panicked at 'Couldn't find node_root_dir in node-gyp output.', libcore\option.rs:960:5
stack backtrace:
0: std::sys::windows::backtrace::unwind_backtrace
at C:\projects\rust\src\libstd\sys\windows\backtrace\mod.rs:65
1: std::sys_common::backtrace::_print
at C:\projects\rust\src\libstd\sys_common\backtrace.rs:71
2: std::sys_common::backtrace::print
at C:\projects\rust\src\libstd\sys_common\backtrace.rs:59
3: std::panicking::default_hook::{{closure}}
at C:\projects\rust\src\libstd\panicking.rs:211
4: std::panicking::default_hook
at C:\projects\rust\src\libstd\panicking.rs:227
5: std::panicking::rust_panic_with_hook
at C:\projects\rust\src\libstd\panicking.rs:511
6: std::panicking::continue_panic_fmt
at C:\projects\rust\src\libstd\panicking.rs:426
7: std::panicking::rust_begin_panic
at C:\projects\rust\src\libstd\panicking.rs:337
8: core::panicking::panic_fmt
at C:\projects\rust\src\libcore\panicking.rs:92
9: core::option::expect_failed
at C:\projects\rust\src\libcore\option.rs:960
10: std::env::set_var
11: alloc::alloc::box_free
12: std::rt::lang_start_internal::{{closure}}
at C:\projects\rust\src\libstd\rt.rs:59
13: std::panicking::try::do_call
at C:\projects\rust\src\libstd\panicking.rs:310
14: panic_unwind::__rust_maybe_catch_panic
at C:\projects\rust\src\libpanic_unwind\lib.rs:105
15: std::panicking::try
at C:\projects\rust\src\libstd\panicking.rs:289
16: std::panic::catch_unwind
at C:\projects\rust\src\libstd\panic.rs:392
17: std::rt::lang_start_internal
at C:\projects\rust\src\libstd\rt.rs:58
18: main
19: invoke_main
at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:64
20: __scrt_common_main_seh
at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253
21: BaseThreadInitThunk
22: RtlUserThreadStart

warning: build failed, waiting for other jobs to finish...
````

This project used to compile but I always needed neon 0.1.20 to get it to work as we were stuck with Node 4.x.
However, now we're migrating to the latest Node LTS (8.x), and thus I've upgraded my Cargo.toml dependencies as well as neon-cli to neon 0.2.0.

What is going wrong here?

UPDATE: manually installing node-gyp globally does not work either, I still get the same error.

Most helpful comment

I'm pretty sure that I had the windows-build-tools already installed, as IIRC neon-based projects can't be built without it at all.
In the end for me it was easier to switch to WASM.

All 6 comments

+1

@C5H8NNaO4 Note that we've since moved to WASM, which does not exhibit such strange build failures. Perhaps that can be a solution for you as well.

I had run into the same error, but fortunately these instructions resolved the situation for me:

From a powershell/command prompt as admin:

npm install --global --production windows-build-tools

I'm pretty sure that I had the windows-build-tools already installed, as IIRC neon-based projects can't be built without it at all.
In the end for me it was easier to switch to WASM.

@kjvalencik Are you sure? I don't see the link between these...

I have exactly the same error:

thread 'main' panicked at 'Couldn't find node_root_dir in node-gyp output.', src\libcore\option.rs:1034:5

Windows 7
Tested with neon-cli versions 0.3.0 (cloned master branch and installed it), 0.2.0, 0.1.20, 0.1.19, 0.1.15, the same error in all these versions
Cargo 1.37.0

Guys, please, can we solve this somehow?
The problem is located exactly here: https://github.com/neon-bindings/neon/blob/d10e78b0cfacbac91c025ef8c6d22d0bfe148208/crates/neon-runtime/build.rs#L47 I am no expert, but maybe there is another way to get node_root_dir then parsing output of node-gyp that apparently doesn't contain that? I'll investigate too..

Full error with stack trace:

--- stderr
thread 'main' panicked at 'Couldn't find node_root_dir in node-gyp output.', src\libcore\option.rs:1034:5
stack backtrace:
   0: std::sys_common::backtrace::_print
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\/src\libstd\sys_common\backtrace.rs:47
   1: std::panicking::default_hook::{{closure}}
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\/src\libstd\panicking.rs:200
   2: std::panicking::default_hook
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\/src\libstd\panicking.rs:216
   3: std::panicking::rust_panic_with_hook
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\/src\libstd\panicking.rs:477
   4: std::panicking::continue_panic_fmt
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\/src\libstd\panicking.rs:384
   5: std::panicking::rust_begin_panic
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\/src\libstd\panicking.rs:311
   6: core::panicking::panic_fmt
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\/src\libcore\panicking.rs:85
   7: core::option::expect_failed
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\/src\libcore\option.rs:1034
   8: core::option::Option<usize>::expect<usize>
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\src\libcore\option.rs:314
   9: build_script_build::parse_node_root_dir
             at .\build.rs:44
  10: build_script_build::build_object_file
             at .\build.rs:97
  11: build_script_build::main
             at .\build.rs:13
  12: std::rt::lang_start::{{closure}}<()>
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\src\libstd\rt.rs:64
  13: std::panicking::try::do_call<closure,i32>
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\/src\libstd\panicking.rs:296
  14: panic_unwind::__rust_maybe_catch_panic
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\/src\libpanic_unwind\lib.rs:82
  15: std::rt::lang_start_internal
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\/src\libstd\rt.rs:48
  16: std::rt::lang_start<()>
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b\src\libstd\rt.rs:64
  17: main
  18: __scrt_common_main_seh
             at d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  19: BaseThreadInitThunk
  20: RtlUserThreadStart
Was this page helpful?
0 / 5 - 0 ratings