lexoyo / Monitoshi

Website uptime monitoring
https://monitoshi.com
79 stars 19 forks source link

npm install fails #5

Closed bmcgonag closed 5 years ago

bmcgonag commented 6 years ago

When I run npm install it fails.

Linux - Ubuntu 18.04 node version 10.2.1 npm version 5.6.0

../node_modules/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’:
../node_modules/nan/nan.h:1477: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 ../lib/kerberos.h:4:0,
                 from ../lib/kerberos.cc:1:
/home/brian/.node-gyp/10.2.1/include/node/node.h:172:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^
/home/brian/.node-gyp/10.2.1/include/node/node.h:88:42: note: in definition of macro ‘NODE_DEPRECATED’
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
kerberos.target.mk:99: recipe for target 'Release/obj.target/kerberos/lib/kerberos.o' failed
make: *** [Release/obj.target/kerberos/lib/kerberos.o] Error 1
make: Leaving directory '/home/brian/Monitoshi/node_modules/kerberos/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:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.15.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 /home/brian/Monitoshi/node_modules/kerberos
gyp ERR! node -v v10.2.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

> ws@0.4.32 install /home/brian/Monitoshi/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory '/home/brian/Monitoshi/node_modules/ws/build'

Any help is appreciated.

lexoyo commented 6 years ago

hello I tried to reproduce and I could not. Even with your version of nodejs. I'm on fedora but it shouldn't be a problem Can you try with the recommended version of node please? (you can do nvm use in the root folder)

FTwex commented 6 years ago

Hi,

I've reproduced (in Docker see below the Dockerfile) an error similar to yours.

I think it's a problem with Node.js 10.x and nan package according to this issue.

> kerberos@0.0.23 install /app/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)

make: Entering directory '/app/node_modules/kerberos/build'
  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
In file included from ../node_modules/nan/nan.h:190:0,
                 from ../lib/kerberos.h:9,
                 from ../lib/kerberos.cc:1:
../node_modules/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)':
../node_modules/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 ../lib/kerberos.h:9:0,
                 from ../lib/kerberos.cc:1:
../node_modules/nan/nan.h: In function 'v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)':
../node_modules/nan/nan.h:833: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 ../lib/kerberos.h:4:0,
                 from ../lib/kerberos.cc:1:
/root/.node-gyp/10.2.1/include/node/node.h:172:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^
/root/.node-gyp/10.2.1/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../lib/kerberos.h:9:0,
                 from ../lib/kerberos.cc:1:
../node_modules/nan/nan.h: In function 'v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)':
../node_modules/nan/nan.h:848: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 ../lib/kerberos.h:4:0,
                 from ../lib/kerberos.cc:1:
/root/.node-gyp/10.2.1/include/node/node.h:165:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^
/root/.node-gyp/10.2.1/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../lib/kerberos.h:9:0,
                 from ../lib/kerberos.cc:1:
../node_modules/nan/nan.h: In function 'v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)':
../node_modules/nan/nan.h:863: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 ../lib/kerberos.h:4:0,
                 from ../lib/kerberos.cc:1:
/root/.node-gyp/10.2.1/include/node/node.h:158:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^
/root/.node-gyp/10.2.1/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../lib/kerberos.h:9:0,
                 from ../lib/kerberos.cc:1:
../node_modules/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':
../node_modules/nan/nan.h:1477: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 ../lib/kerberos.h:4:0,
                 from ../lib/kerberos.cc:1:
/root/.node-gyp/10.2.1/include/node/node.h:172:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^
/root/.node-gyp/10.2.1/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
kerberos.target.mk:99: recipe for target 'Release/obj.target/kerberos/lib/kerberos.o' failed
make: *** [Release/obj.target/kerberos/lib/kerberos.o] Error 1
make: Leaving directory '/app/node_modules/kerberos/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:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.9.87-linuxkit-aufs
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /app/node_modules/kerberos
gyp ERR! node -v v10.2.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

Dockerfile:

FROM ubuntu:18.04

RUN apt-get update
RUN apt-get install -yq curl gnupg2 git make g++ libkrb5-dev krb5-kdc
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g prebuild pm2

RUN mkdir /app
COPY . /app

WORKDIR /app

RUN npm i

CMD pm2-runtime start start .pm2.json

EXPOSE 7070
bmcgonag commented 6 years ago

Ok. So it is likely related to using the latest modejs. I looked, but guess I missed the recommended version of node in the main ReadMe file. I’ll look again.

lexoyo commented 6 years ago

The recommended version is in the .mvn file Not sure if I've mentioned it in the readme (PRs welcome) Should I close this issue?

lexoyo commented 6 years ago

And I guess we should keep this dockerfile :)

bmcgonag commented 6 years ago

WEnt back to nodejs 6.2.2 with NVM, and the build seemed to work, but now when i run node app I get an unhandled exception error after trying to connect to Mongo collection monitoshi.

lexoyo commented 6 years ago

Oh ok Did you start mongodb before monitoshi?

bmcgonag commented 6 years ago

I did. I really want to make this work. If I can get it working I can potentially help bring it up to date for node and the modules that give deprecation warnings. I love the concept behind this project.

I’ve been looking for a project just like this one for a while.

Brian McGonagill

On May 27, 2018, at 2:53 PM, Alex Hoyau notifications@github.com wrote:

Oh ok Did you start mongodb before monitoshi?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

lexoyo commented 6 years ago

Can you post the exception?

bmcgonag commented 6 years ago

Yep. Give me just a bit

Brian McGonagill

On May 27, 2018, at 6:02 PM, Alex Hoyau notifications@github.com wrote:

Can you post the exception?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

bmcgonag commented 6 years ago

When I run node app I get this error, which is unfortunately not really useful for me.

~/Monitoshi$ node app
MT_CONFIG env variable is not defined, and MT_CONFIG_FILE is set to undefined The config will be read from /home/brian/Monitoshi/app/../config.js
***********************************
Monitoshi starting
***********************************
Connecting to mongodb mongodb://localhost:27017/moni... - collectionName=monitoshi
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::7070
    at Object.exports._errnoException (util.js:1007:11)
    at exports._exceptionWithHostPort (util.js:1030:20)
    at Server._listen2 (net.js:1253:14)
    at listen (net.js:1289:10)
    at Server.listen (net.js:1385:5)
    at EventEmitter.app.listen (/home/brian/Monitoshi/node_modules/express/lib/application.js:559:24)
    at Object.<anonymous> (/home/brian/Monitoshi/app/index.js:256:7)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)

Maybe you can help me with it. I'll try to pick away at it.

bmcgonag commented 6 years ago

Ok that time, I forgot to start mongo first...so here's what I get when mongo is running.

Monitoshi$ node app
MT_CONFIG env variable is not defined, and MT_CONFIG_FILE is set to undefined The config will be read from /home/brian/Monitoshi/app/../config.js
***********************************
Monitoshi starting
***********************************
Connecting to mongodb mongodb://localhost:27017/moni... - collectionName=monitoshi
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::7070
    at Object.exports._errnoException (util.js:1007:11)
    at exports._exceptionWithHostPort (util.js:1030:20)
    at Server._listen2 (net.js:1253:14)
    at listen (net.js:1289:10)
    at Server.listen (net.js:1385:5)
    at EventEmitter.app.listen (/home/brian/Monitoshi/node_modules/express/lib/application.js:559:24)
    at Object.<anonymous> (/home/brian/Monitoshi/app/index.js:256:7)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
FTwex commented 6 years ago

EADDRINUSE tell you that your localhost address with port 7070 is already in use by another process.

Try finding this process with the command: lsof -n -i :7070 | grep LISTEN

bmcgonag commented 6 years ago

Interestingn Anydesk runs on the same port. Can I run the app on a different port?

lexoyo commented 6 years ago

Sure, you can set the PORT environment variable

It comes from this part of the code https://github.com/lexoyo/Monitoshi/blob/master/app/index.js#L256

lexoyo commented 5 years ago

As this is fixed I'll close the issue Thx for the help @FTwex