When trying to build the Arch package with nodejs 10.0, an error is encountered.
Try to build mattermost with nodejs 10.
It builds fine.
It fails:
g++ '-DNODE_GYP_MODULE_NAME=binding' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/build/.node-gyp/10.0.0/include/node -I/build/.node-gyp/10.0.0/src -I/build/.node-gyp/10.0.0/deps/uv/include -I/build/.node-gyp/10.0.0/deps/v8/include -I../../nan -I../src/libsass/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -std=c++0x -MMD -MF ./Release/.deps/Release/obj.target/binding/src/binding.o.d.raw -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -c -o Release/obj.target/binding/src/binding.o ../src/binding.cpp
In file included from ../../nan/nan.h:192:0,
from ../src/binding.cpp:1:
../../nan/nan_maybe_43_inl.h: In function ‘Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’:
../../nan/nan_maybe_43_inl.h:112:15: error: ‘class v8::Object’ has no member named ‘ForceSet’
return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
^~~~~~~~
In file included from ../src/binding.cpp:1:0:
../../nan/nan.h: In function ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’:
../../nan/nan.h:835:60: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
v8::Isolate::GetCurrent(), target, func, argc, argv);
^
In file included from ../../nan/nan.h:49:0,
from ../src/binding.cpp:1:
/build/.node-gyp/10.0.0/include/node/node.h:172:50: note: declared here
NODE_EXTERN v8::Local<v8::Value> MakeCallback(
^
/build/.node-gyp/10.0.0/include/node/node.h:88:42: note: in definition of macro ‘NODE_DEPRECATED’
__attribute__((deprecated(message))) declarator
^~~~~~~~~~
In file included from ../src/binding.cpp:1:0:
../../nan/nan.h: In function ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’:
../../nan/nan.h:850:62: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
v8::Isolate::GetCurrent(), target, symbol, argc, argv);
^
In file included from ../../nan/nan.h:49:0,
from ../src/binding.cpp:1:
/build/.node-gyp/10.0.0/include/node/node.h:165:50: note: declared here
NODE_EXTERN v8::Local<v8::Value> MakeCallback(
^
/build/.node-gyp/10.0.0/include/node/node.h:88:42: note: in definition of macro ‘NODE_DEPRECATED’
__attribute__((deprecated(message))) declarator
^~~~~~~~~~
In file included from ../src/binding.cpp:1:0:
../../nan/nan.h: In function ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)’:
../../nan/nan.h:865:62: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
v8::Isolate::GetCurrent(), target, method, argc, argv);
^
In file included from ../../nan/nan.h:49:0,
from ../src/binding.cpp:1:
/build/.node-gyp/10.0.0/include/node/node.h:158:50: note: declared here
NODE_EXTERN v8::Local<v8::Value> MakeCallback(
^
/build/.node-gyp/10.0.0/include/node/node.h:88:42: note: in definition of macro ‘NODE_DEPRECATED’
__attribute__((deprecated(message))) declarator
^~~~~~~~~~
In file included from ../src/binding.cpp:1:0:
../../nan/nan.h: In member function ‘v8::Local<v8::Value> Nan::Callback::Call_(v8::Isolate*, v8::Local<v8::Object>, int, v8::Local<v8::Value>*) const’:
../../nan/nan.h:1479:5: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
));
^
In file included from ../../nan/nan.h:49:0,
from ../src/binding.cpp:1:
/build/.node-gyp/10.0.0/include/node/node.h:172:50: note: declared here
NODE_EXTERN v8::Local<v8::Value> MakeCallback(
^
/build/.node-gyp/10.0.0/include/node/node.h:88:42: note: in definition of macro ‘NODE_DEPRECATED’
__attribute__((deprecated(message))) declarator
^~~~~~~~~~
make[2]: *** [binding.target.mk:115: Release/obj.target/binding/src/binding.o] Error 1
make[2]: Leaving directory '/build/mattermost/src/mattermost-webapp/node_modules/node-sass/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/build/mattermost/src/mattermost-webapp/node_modules/node-gyp/lib/build.js:285:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Linux 4.16.3-1-ARCH
gyp ERR! command "/usr/bin/node" "/build/mattermost/src/mattermost-webapp/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /build/mattermost/src/mattermost-webapp/node_modules/node-sass
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
Build failed with error code: 1
make[1]: *** [Makefile:20: .yarninstall] Error 1
make[1]: Leaving directory '/build/mattermost/src/mattermost-webapp'
make: *** [build/release.mk:32: build-client] Error 2
Note even sure if the issue is with mattermost itself, one of its dependencies or elsewhere.
Probably related: https://github.com/nodejs/nan/issues/504#issuecomment-385296082
Indeed. After some reading around this, it looks like this is due to an outdated version of nan
pulled in by something.
Would you mind sharing the complete build log? (I can't reproduce your build failure with nodejs 10.0.0-1nodesource1
on Ubuntu 14.04.5 LTS - probably missing something. Here's my build log.)
I don’t have such a verbose log, but anyway here is mine: https://paste.xinu.at/YO98rh/
@ArchangeGabriel Hi Bruno. Like exeplained on the AUR page, I fixed the issue. Mattermost was indeed using an old version of nan. I just patched the respective package.json
in order to dependency tree choose a more recent version of nan and this fixed the issue.
Btw, the problem won't happen with Mattermost 4.10 as they switched back to npm and updated the dependencies in the process, which fixes our issue.
I think we can close the issue now.
Thanks @wget!
Most helpful comment
@ArchangeGabriel Hi Bruno. Like exeplained on the AUR page, I fixed the issue. Mattermost was indeed using an old version of nan. I just patched the respective
package.json
in order to dependency tree choose a more recent version of nan and this fixed the issue.Btw, the problem won't happen with Mattermost 4.10 as they switched back to npm and updated the dependencies in the process, which fixes our issue.