Errors when running npm install in node-red (source code install)

Hi, I am getting errors when npm installing under node-red (running form source)

It seems there is dev dep mosca that tries to install modules that fail to install/build on my system (node -v 12.16.1, windows 10)

This is a sample of the many many errors...

c:\users\stephen\repos\github\node-red\node_modules\kerberos\node_modules\nan\nan_implementation_12_inl.h(103): error C
2664: 'v8::MaybeLocal<v8::Function> v8::Function::New(v8::Local<v8::Context>,v8::FunctionCallback,v8::Local<v8::Value>,
int,v8::ConstructorBehavior,v8::SideEffectType)': cannot convert argument 1 from 'v8::Isolate *' to 'v8::Local<v8::Cont
ext>' (compiling source file ..\lib\win32\wrappers\security_context.cc) [c:\Users\Stephen\repos\github\node-red\node_mo
dules\kerberos\build\kerberos.vcxproj]
c:\users\stephen\repos\github\node-red\node_modules\fs-ext\fs-ext.cc(153): warning C4996: 'Nan::Callback::Call': was de
clared deprecated [c:\Users\Stephen\repos\github\node-red\node_modules\fs-ext\build\fs-ext.vcxproj]
  c:\users\stephen\repos\github\node-red\node_modules\nan\nan.h(1740): note: see declaration of 'Nan::Callback::Call'
c:\users\stephen\repos\github\node-red\node_modules\fs-ext\fs-ext.cc(195): error C3861: 'fcntl': identifier not found [
c:\Users\Stephen\repos\github\node-red\node_modules\fs-ext\build\fs-ext.vcxproj]
c:\users\stephen\repos\github\node-red\node_modules\fs-ext\fs-ext.cc(281): error C2660: 'v8::Value::Int32Value': functi
on does not take 0 arguments [c:\Users\Stephen\repos\github\node-red\node_modules\fs-ext\build\fs-ext.vcxproj]
  c:\users\stephen\appdata\local\node-gyp\cache\12.16.1\include\node\v8.h(2709): note: see declaration of 'v8::Value::I
  nt32Value' (compiling source file ..\fs-ext.cc)
c:\users\stephen\repos\github\node-red\node_modules\fs-ext\fs-ext.cc(282): error C2660: 'v8::Value::Int32Value': functi
on does not take 0 arguments [c:\Users\Stephen\repos\github\node-red\node_modules\fs-ext\build\fs-ext.vcxproj]
  c:\users\stephen\appdata\local\node-gyp\cache\12.16.1\include\node\v8.h(2709): note: see declaration of 'v8::Value::I
  nt32Value' (compiling source file ..\fs-ext.cc)

And... so... on...


Essentially, npm install has errors related to kerberos, leveldown, snappy, zmq and fs-ext all of which are dependencies of mosca

$ npm ls kerberos
node-red@1.2.2 c:\Users\Stephen\repos\github\node-red
`-- mosca@2.8.3
  `-- ascoltatori@3.2.0
    `-- kerberos@0.0.24
$ npm ls leveldown
node-red@1.2.2 C:\Users\Stephen\repos\github\node-red
`-- mosca@2.8.3
  `-- UNMET OPTIONAL DEPENDENCY leveldown@1.4.6
$ npm ls zmq
node-red@1.2.2 C:\Users\Stephen\repos\github\node-red
`-- mosca@2.8.3
  `-- ascoltatori@3.2.0
    `-- UNMET OPTIONAL DEPENDENCY zmq@2.15.3
$ npm ls snappy
node-red@1.2.2 C:\Users\Stephen\repos\github\node-red
`-- mosca@2.8.3
  `-- ascoltatori@3.2.0
    `-- kafka-node@0.5.9
      `-- UNMET OPTIONAL DEPENDENCY snappy@5.0.5 
$ npm ls fs-ext
node-red@1.2.2 C:\Users\Stephen\repos\github\node-red
`-- mosca@2.8.3
  `-- ascoltatori@3.2.0
    `-- qlobber-fsq@3.2.4
      `-- UNMET OPTIONAL DEPENDENCY fs-ext@0.5.0

The thing is - mosca is now dead (replaced by Aedes)

Why is mosca a dev requirement?

The only reference to the package is in the file ./test/editor/specs/scenario/cookbook_mqtt_uispec.js.

It appears to use mosca as a dedicated MQTT broker to test ... something! Not clear what or why.

1 Like

It's a UI test that validates the MQTT cookbook recipes work - hence why it depends on an MQTT broker.

Not convinced we get a lot of value from those tests. Been meaning to review them properly - particularly given the size of the dependencies they pull in versus their value.

2 Likes

Tests tend to be omitted by many of contrib nodes I have used as well. I don't usually create explicit tests for the custom nodes I create as well.

I would love to add tests to my custom nodes but I find the whole thing too complex to get my head around not being a full-time developer.

Instead I've started to add test flows with a function node that checks the output data.

Yeah, I have done that as well, flows that validate your custom node, also with a bit of care in design, serve as examples on proper use. So you get an added benefit.

1 Like

Just to close this off, we already have a script that is run to install the extra dependencies needed by the UI testing. I've moved mosca over to that script so it won't be installed by default.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.