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

npm install bumps into gyp build error #1804

Closed
khteh opened this issue Jul 3, 2019 · 2 comments
Closed

npm install bumps into gyp build error #1804

khteh opened this issue Jul 3, 2019 · 2 comments

Comments

@khteh
Copy link

khteh commented Jul 3, 2019

  • Node Version:
    node: v12.5.0
    npm: 6.9.2

  • Platform:
    Linux KHTeh-T490 5.0.0-20-generic #21-Ubuntu SMP Mon Jun 24 09:32:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

  • Compiler:

Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 8.3.0-6ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Ubuntu 8.3.0-6ubuntu1) 
  • Module:
Verbose output (from npm or node-gyp):
Paste your log here, between the backticks. It can be:
  - npm --verbose output,
  - or contents of npm-debug.log,
  - or output of node-gyp rebuild --verbose.
$ npm install
> phantomjs-prebuilt@2.1.16 install /usr/src/4xlabs/bz-ui2/node_modules/karma-phantomjs-launcher/node_modules/phantomjs-prebuilt
> node install.js
PhantomJS not found on PATH
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /usr/src/4xlabs/bz-ui2/node_modules/karma-phantomjs-launcher/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1562130978125/phantomjs-2.1.1-linux-x86_64 -> /usr/src/4xlabs/bz-ui2/node_modules/karma-phantomjs-launcher/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /usr/src/4xlabs/bz-ui2/node_modules/karma-phantomjs-launcher/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs

> puppeteer@1.13.0 install /usr/src/4xlabs/bz-ui2/node_modules/puppeteer
> node install.js

Downloading Chromium r637110 - 109.4 Mb [====================] 100% 0.0s 
Chromium downloaded to /usr/src/4xlabs/bz-ui2/node_modules/puppeteer/.local-chromium/linux-637110

> sharp@0.20.8 install /usr/src/4xlabs/bz-ui2/node_modules/gulp-responsive/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-linux-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=12.5.0 runtime=node arch=x64 platform=linux)
make: Entering directory '/usr/src/4xlabs/bz-ui2/node_modules/gulp-responsive/node_modules/sharp/build'
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:24:
../../../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../../../nan/nan.h:2298:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
In file included from ../src/common.cc:27:
../src/common.h: At global scope:
../src/common.h:82:20: error: ‘Handle’ is not a member of ‘v8’
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
                    ^~~~~~
../src/common.h:82:37: error: expected primary-expression before ‘>’ token
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
                                     ^
../src/common.h:82:39: error: ‘obj’ was not declared in this scope
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
                                       ^~~
../src/common.h:82:56: error: expected primary-expression before ‘attr’
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
                                                        ^~~~
../src/common.h:82:60: error: expression list treated as compound expression in initializer [-fpermissive]
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
                                                            ^
../src/common.h:83:29: error: ‘Handle’ is not a member of ‘v8’
   std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
                             ^~~~~~
../src/common.h:83:46: error: expected primary-expression before ‘>’ token
   std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
                                              ^
../src/common.h:83:48: error: ‘obj’ was not declared in this scope
   std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
                                                ^~~
../src/common.h:83:65: error: expected primary-expression before ‘attr’
   std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
                                                                 ^~~~
../src/common.h:84:48: error: ‘Handle’ is not a member of ‘v8’
   template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                                ^~~~~~
../src/common.h:84:65: error: expected primary-expression before ‘>’ token
   template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                                                 ^
../src/common.h:84:67: error: ‘obj’ was not declared in this scope
   template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                                                   ^~~
../src/common.h:84:84: error: expected primary-expression before ‘attr’
   template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                                                                    ^~~~
../src/common.h:84:37: warning: variable templates only available with -std=c++14 or -std=gnu++14
   template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                     ^~~~~~
../src/common.h:84:89: error: expected ‘;’ before ‘{’ token
   template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
                                                                                         ^~
                                                                                         ;
../src/common.h:87:37: error: ‘Handle’ is not a member of ‘v8’
   template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                                     ^~~~~~
../src/common.h:87:54: error: expected primary-expression before ‘>’ token
   template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                                                      ^
../src/common.h:87:56: error: ‘obj’ was not declared in this scope
   template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                                                        ^~~
../src/common.h:87:73: error: expected primary-expression before ‘attr’
   template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                                                                         ^~~~
../src/common.h:87:26: warning: variable templates only available with -std=c++14 or -std=gnu++14
   template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                          ^~~~~~
../src/common.h:87:78: error: expected ‘;’ before ‘{’ token
   template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                                                                              ^~
                                                                              ;
../src/common.h:90:37: error: ‘Handle’ is not a member of ‘v8’
   template<typename T> T AttrTo(v8::Handle<v8::Object> obj, int attr) {
                                     ^~~~~~
../src/common.h:90:54: error: expected primary-expression before ‘>’ token
   template<typename T> T AttrTo(v8::Handle<v8::Object> obj, int attr) {
                                                      ^
../src/common.h:90:56: error: ‘obj’ was not declared in this scope
   template<typename T> T AttrTo(v8::Handle<v8::Object> obj, int attr) {
                                                        ^~~
../src/common.h:90:61: error: expected primary-expression before ‘int’
   template<typename T> T AttrTo(v8::Handle<v8::Object> obj, int attr) {
                                                             ^~~
../src/common.h:87:26: warning: variable templates only available with -std=c++14 or -std=gnu++14
   template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
                          ^~~~~~
../src/common.h:90:70: error: expected ‘;’ before ‘{’ token
   template<typename T> T AttrTo(v8::Handle<v8::Object> obj, int attr) {
                                                                      ^~
                                                                      ;
../src/common.h:96:9: error: ‘Handle’ is not a member of ‘v8’
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
         ^~~~~~
../src/common.h:96:26: error: expected primary-expression before ‘>’ token
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
                          ^
../src/common.h:96:28: error: ‘input’ was not declared in this scope
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
                            ^~~~~
../src/common.h:96:28: note: suggested alternative: ‘ino_t’
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
                            ^~~~~
                            ino_t
../src/common.h:96:70: error: expected primary-expression before ‘&’ token
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
                                                                      ^
../src/common.h:96:71: error: ‘buffersToPersist’ was not declared in this scope
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
                                                                       ^~~~~~~~~~~~~~~~
../src/common.h:96:87: error: expression list treated as compound expression in initializer [-fpermissive]
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
                                                                                       ^
../src/common.cc:34:20: error: redefinition of ‘bool sharp::HasAttr’
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr) {
                    ^~~~~~
In file included from ../src/common.cc:27:
../src/common.h:82:8: note: ‘bool sharp::HasAttr’ previously defined here
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
        ^~~~~~~
../src/common.cc:34:20: error: ‘Handle’ is not a member of ‘v8’
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr) {
                    ^~~~~~
../src/common.cc:34:37: error: expected primary-expression before ‘>’ token
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr) {
                                     ^
../src/common.cc:34:39: error: ‘obj’ was not declared in this scope
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr) {
                                       ^~~
../src/common.cc:34:56: error: expected primary-expression before ‘attr’
   bool HasAttr(v8::Handle<v8::Object> obj, std::string attr) {
                                                        ^~~~
../src/common.cc:37:29: error: redefinition of ‘std::string sharp::AttrAsStr’
   std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr) {
                             ^~~~~~
In file included from ../src/common.cc:27:
../src/common.h:83:15: note: ‘std::string sharp::AttrAsStr’ previously declared here
   std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
               ^~~~~~~~~
../src/common.cc:37:29: error: ‘Handle’ is not a member of ‘v8’
   std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr) {
                             ^~~~~~
../src/common.cc:37:46: error: expected primary-expression before ‘>’ token
   std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr) {
                                              ^
../src/common.cc:37:48: error: ‘obj’ was not declared in this scope
   std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr) {
                                                ^~~
../src/common.cc:37:65: error: expected primary-expression before ‘attr’
   std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr) {
                                                                 ^~~~
../src/common.cc:43:9: error: redefinition of ‘sharp::InputDescriptor* sharp::CreateInputDescriptor’
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
         ^~~~~~
In file included from ../src/common.cc:27:
../src/common.h:95:20: note: ‘sharp::InputDescriptor* sharp::CreateInputDescriptor’ previously defined here
   InputDescriptor* CreateInputDescriptor(
                    ^~~~~~~~~~~~~~~~~~~~~
../src/common.cc:43:9: error: ‘Handle’ is not a member of ‘v8’
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
         ^~~~~~
../src/common.cc:43:26: error: expected primary-expression before ‘>’ token
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
                          ^
../src/common.cc:43:28: error: ‘input’ was not declared in this scope
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
                            ^~~~~
../src/common.cc:43:28: note: suggested alternative: ‘ino_t’
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
                            ^~~~~
                            ino_t
../src/common.cc:43:70: error: expected primary-expression before ‘&’ token
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
                                                                      ^
../src/common.cc:43:71: error: ‘buffersToPersist’ was not declared in this scope
     v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
                                                                       ^~~~~~~~~~~~~~~~
In file included from /home/khteh/.node-gyp/12.5.0/include/node/node.h:63,
                 from ../src/common.cc:22:
/home/khteh/.node-gyp/12.5.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/khteh/.node-gyp/12.5.0/include/node/node_object_wrap.h:84:78:   required from here
/home/khteh/.node-gyp/12.5.0/include/node/v8.h:9846:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/khteh/.node-gyp/12.5.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../../../nan/nan_object_wrap.h:65:61:   required from here
/home/khteh/.node-gyp/12.5.0/include/node/v8.h:9846:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
make: *** [sharp.target.mk:132: Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/usr/src/4xlabs/bz-ui2/node_modules/gulp-responsive/node_modules/sharp/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 5.0.0-20-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/4xlabs/bz-ui2/node_modules/gulp-responsive/node_modules/sharp
gyp ERR! node -v v12.5.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN bz-ui2 No repository field.
npm WARN bz-ui2 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.20.8 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sharp@0.20.8 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/khteh/.npm/_logs/2019-07-03T05_16_43_269Z-debug.log
@rvagg
Copy link
Member

rvagg commented Jul 3, 2019

These types of errors, pointing to v8:: types, usually mean that the dependency being installed is not compatible with the version of Node you are using. In this cause you're using Node 12, so it's not too surprising since it takes a while for (a) add-ons to be made compatible with new breaking versions of Node.js and (b) those updated addons to be updated in packages that depend on them.

The breaking package is sharp, https://github.com/lovell/sharp, it looks like its most recent versions have Node 12 support: https://github.com/lovell/sharp/blob/cfa4f7d45c0dc4c098bb6e4a665720ee373af830/.travis.yml#L26

The latest version of sharp is 0.22.1, it looks like you are using 0.20.8.

If this is a dependency of your project, update to the latest version. If this package is a dependency of dependency (of a ...) in your project then you'll need to chase down the author of the dependency that's using it and encourage them to update. Or, your other option is to downgrade your version of Node to find one that works. Node 10 might be safer.

@tada123
Copy link

tada123 commented Apr 17, 2023

Just found theese lines in "/usr/include/node/v8-local-handle.h#328":

#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
// Handle is an alias for Local for historical reasons.
template <class T>
using Handle = Local<T>;
#endif

This error also occurs when trying to build C++ module using gyp. It seems, that v8::Handle can just be replaced with Local<TYPENAME> declaration

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

3 participants