Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to install on Node 19 #339

Closed
danielrozenberg opened this issue Jan 12, 2023 · 8 comments
Closed

Failing to install on Node 19 #339

danielrozenberg opened this issue Jan 12, 2023 · 8 comments

Comments

@danielrozenberg
Copy link

Using node 19.4.0 and npm 9.2.0, I'm getting a C++ compilation error during installation:

daniel@lappy:~/test$ nvm use v19
Now using node v19.4.0 (npm v9.2.0)
daniel@lappy:~/test$ npm i isolated-vm
npm ERR! code 1
npm ERR! path /home/daniel/test/node_modules/isolated-vm
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild --release -j 4
npm ERR! make: Entering directory '/home/daniel/test/node_modules/isolated-vm/build'
npm ERR!   CXX(target) Release/obj.target/nortti/src/external_copy/serializer_nortti.o
npm ERR!   CXX(target) Release/obj.target/nortti/src/isolate/allocator_nortti.o
npm ERR! make: Leaving directory '/home/daniel/test/node_modules/isolated-vm/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp info find Python using Python version 3.10.9 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/daniel/.nvm/versions/node/v19.4.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/daniel/test/node_modules/isolated-vm/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/daniel/.nvm/versions/node/v19.4.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/daniel/.cache/node-gyp/19.4.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/daniel/.cache/node-gyp/19.4.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/daniel/.nvm/versions/node/v19.4.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/daniel/.cache/node-gyp/19.4.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/daniel/test/node_modules/isolated-vm',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build', '--jobs', 4 ]
npm ERR! In file included from /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-object.h:9,
npm ERR!                  from /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-array-buffer.h:13,
npm ERR!                  from /home/daniel/.cache/node-gyp/19.4.0/include/node/v8.h:24,
npm ERR!                  from ../src/isolate/allocator.h:2,
npm ERR!                  from ../src/isolate/allocator_nortti.cc:1:
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:106:45: error: ‘is_lvalue_reference_v’ is not a member of ‘std’; did you mean ‘is_lvalue_reference’?
npm ERR!   106 |   template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
npm ERR!       |                                             ^~~~~~~~~~~~~~~~~~~~~
npm ERR!       |                                             is_lvalue_reference
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:106:66: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
npm ERR!   106 |   template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
npm ERR!       |                                                                  ^
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:106:67: error: template argument 1 is invalid
npm ERR!   106 |   template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
npm ERR!       |                                                                   ^
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:106:71: error: expected unqualified-id before ‘>’ token
npm ERR!   106 |   template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
npm ERR!       |                                                                       ^
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:123:43: error: ‘is_lvalue_reference_v’ is not a member of ‘std’; did you mean ‘is_lvalue_reference’?
npm ERR!   123 | template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
npm ERR!       |                                           ^~~~~~~~~~~~~~~~~~~~~
npm ERR!       |                                           is_lvalue_reference
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:123:64: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
npm ERR!   123 | template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
npm ERR!       |                                                                ^
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:123:65: error: template argument 1 is invalid
npm ERR!   123 | template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
npm ERR!       |                                                                 ^
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:123:70: error: expected unqualified-id before ‘=’ token
npm ERR!   123 | template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
npm ERR!       |                                                                      ^
npm ERR! In file included from /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-object.h:9,
npm ERR!                  from /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-array-buffer.h:13,
npm ERR!                  from /home/daniel/.cache/node-gyp/19.4.0/include/node/v8.h:24,
npm ERR!                  from ../src/external_copy/external_copy.h:2,
npm ERR!                  from ../src/external_copy/serializer.h:2,
npm ERR!                  from ../src/external_copy/serializer_nortti.cc:1:
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:106:45: error: ‘is_lvalue_reference_v’ is not a member of ‘std’; did you mean ‘is_lvalue_reference’?
npm ERR!   106 |   template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
npm ERR!       |                                             ^~~~~~~~~~~~~~~~~~~~~
npm ERR!       |                                             is_lvalue_reference
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:106:66: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
npm ERR!   106 |   template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
npm ERR!       |                                                                  ^
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:106:67: error: template argument 1 is invalid
npm ERR!   106 |   template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
npm ERR!       |                                                                   ^
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:106:71: error: expected unqualified-id before ‘>’ token
npm ERR!   106 |   template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
npm ERR!       |                                                                       ^
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:123:43: error: ‘is_lvalue_reference_v’ is not a member of ‘std’; did you mean ‘is_lvalue_reference’?
npm ERR!   123 | template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
npm ERR!       |                                           ^~~~~~~~~~~~~~~~~~~~~
npm ERR!       |                                           is_lvalue_reference
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:123:64: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
npm ERR!   123 | template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
npm ERR!       |                                                                ^
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:123:65: error: template argument 1 is invalid
npm ERR!   123 | template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
npm ERR!       |                                                                 ^
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-maybe.h:123:70: error: expected unqualified-id before ‘=’ token
npm ERR!   123 | template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
npm ERR!       |                                                                      ^
npm ERR! In file included from ../src/module/transferable.h:2,
npm ERR!                  from ../src/external_copy/serializer_nortti.cc:3:
npm ERR! ../src/isolate/class_handle.h:65:39: error: ‘AccessorSignature’ is not a member of ‘v8’
npm ERR!    65 |                         v8::Local<v8::AccessorSignature>& asig;
npm ERR!       |                                       ^~~~~~~~~~~~~~~~~
npm ERR! ../src/isolate/class_handle.h:65:39: error: ‘AccessorSignature’ is not a member of ‘v8’
npm ERR! ../src/isolate/class_handle.h:65:56: error: template argument 1 is invalid
npm ERR!    65 |                         v8::Local<v8::AccessorSignature>& asig;
npm ERR!       |                                                        ^
npm ERR! ../src/isolate/class_handle.h: In member function ‘void ivm::ClassHandle::TemplateDefinition::Add(const char*, ivm::detail::MemberAccessorHolder, Args ...)’:
npm ERR! ../src/isolate/class_handle.h:95:51: error: no matching function for call to ‘v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>&, void (* const&)(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&), void (* const&)(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&), v8::Local<v8::String>&, v8::AccessControl, v8::PropertyAttribute, int&)’
npm ERR!    95 |                                 proto->SetAccessor(name_handle, impl.getter.callback, impl.setter.callback, name_handle, v8::AccessControl::DEFAULT, v8::PropertyAttribute::None, asig);
npm ERR!       |                                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-function.h:15,
npm ERR!                  from /home/daniel/.cache/node-gyp/19.4.0/include/node/v8.h:33:
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-template.h:814:8: note: candidate: ‘void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::SideEffectType, v8::SideEffectType)’
npm ERR!   814 |   void SetAccessor(
npm ERR!       |        ^~~~~~~~~~~
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-template.h:819:22: note:   no known conversion for argument 7 from ‘int’ to ‘v8::SideEffectType’
npm ERR!   819 |       SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
npm ERR!       |       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-template.h:807:8: note: candidate: ‘void v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>, v8::AccessorGetterCallback, v8::AccessorSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::SideEffectType, v8::SideEffectType)’
npm ERR!   807 |   void SetAccessor(
npm ERR!       |        ^~~~~~~~~~~
npm ERR! /home/daniel/.cache/node-gyp/19.4.0/include/node/v8-template.h:812:22: note:   no known conversion for argument 7 from ‘int’ to ‘v8::SideEffectType’
npm ERR!   812 |       SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
npm ERR!       |       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../src/isolate/class_handle.h: In static member function ‘static v8::Local<v8::FunctionTemplate> ivm::ClassHandle::MakeClass(const char*, ivm::detail::ConstructorFunctionHolder, Args ...)’:
npm ERR! ../src/isolate/class_handle.h:177:39: error: ‘AccessorSignature’ is not a member of ‘v8’
npm ERR!   177 |                         v8::Local<v8::AccessorSignature> asig = v8::AccessorSignature::New(isolate, tmpl);
npm ERR!       |                                       ^~~~~~~~~~~~~~~~~
npm ERR! ../src/isolate/class_handle.h:177:39: error: ‘AccessorSignature’ is not a member of ‘v8’
npm ERR! ../src/isolate/class_handle.h:177:56: error: template argument 1 is invalid
npm ERR!   177 |                         v8::Local<v8::AccessorSignature> asig = v8::AccessorSignature::New(isolate, tmpl);
npm ERR!       |                                                        ^
npm ERR! ../src/isolate/class_handle.h:177:69: error: ‘v8::AccessorSignature’ has not been declared
npm ERR!   177 |                         v8::Local<v8::AccessorSignature> asig = v8::AccessorSignature::New(isolate, tmpl);
npm ERR!       |                                                                     ^~~~~~~~~~~~~~~~~
npm ERR! make: *** [nortti.target.mk:164: Release/obj.target/nortti/src/isolate/allocator_nortti.o] Error 1
npm ERR! make: *** Waiting for unfinished jobs....
npm ERR! make: *** [nortti.target.mk:164: Release/obj.target/nortti/src/external_copy/serializer_nortti.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/home/daniel/.nvm/versions/node/v19.4.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 5.19.11-1rodete1-amd64
npm ERR! gyp ERR! command "/home/daniel/.nvm/versions/node/v19.4.0/bin/node" "/home/daniel/.nvm/versions/node/v19.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release" "-j" "4"
npm ERR! gyp ERR! cwd /home/daniel/test/node_modules/isolated-vm
npm ERR! gyp ERR! node -v v19.4.0
npm ERR! gyp ERR! node-gyp -v v9.3.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/daniel/.npm/_logs/2023-01-12T17_57_02_653Z-debug-0.log

Anything else I can add here to help debug this?

@idleman
Copy link
Contributor

idleman commented Jan 16, 2023

I can confirm I got this error as well some weeks ago. I just rolled back to a previous version of node as a temporary "solution", but sooner or later will I need to fix it.

@danielrozenberg
Copy link
Author

Let me know if there's anything I can do to help investigate/resolve this!

@idleman
Copy link
Contributor

idleman commented Jan 17, 2023

Similar error.

I can fix so the code compiles by remove the AccessorSignature and when update the OOMErrorCallback to take a v8::OOMDetails as second argument instead of boolean. However, the process crashes as soon a Isolate is being constructed - so clearly I am forgetting something.

Unfortunately do I not have so much time to debug it further.

@laverdet
Copy link
Owner

laverdet commented Feb 11, 2023

Minor deprecations aside there is a more serious issue that @idleman also observed. I bisected this back to v8 commit v8/v8@de02b4c which is in the same area as the segfault trace or dcheck failure (when running node_g). I checked some newer versions of v8 to see if the issue was resolved but the latest I could get to compile with nodejs was 10.9.150 [10.7.193.13 is most current in nodejs], and it still failed in the newer version.

I'll have to investigate further another time. The issue has such a trivial reproduction case that I'm hoping it's just something simple that's been overlooked.

update: It works with --no-node-snapshot

@saikumarrs
Copy link

update: It works with --no-node-snapshot

@laverdet, can you explain how to make it work?

@laverdet
Copy link
Owner

laverdet commented Mar 3, 2023

You have to install from git since this change is not on npm. There is a larger question about shared snapshot state that I may need to raise with the v8 team. I'm not sure yet.

@saikumarrs
Copy link

@laverdet, thanks. I installed the package from NPM. However, it is unstable. The dependencies install locally but occasionally fail in GitHub actions.
Do you have a rough date for the next stable release?

I really appreciate any help you can provide.

@laverdet
Copy link
Owner

v4.5.0 on npm fixes these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants