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

**URL:** <https://discourse.nodered.org/t/errors-when-running-npm-install-in-node-red-source-code-install/35156>\
**Category:** Core Development\
**Created:** [1 November 2020 12:34 UTC](https://discourse.nodered.org/t/errors-when-running-npm-install-in-node-red-source-code-install/35156 "2020-11-01T12:34:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 November 2020 12:34 UTC](https://discourse.nodered.org/t/errors-when-running-npm-install-in-node-red-source-code-install/35156/1 "2020-11-01T12:34:44Z")

</div>

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...

```bash
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]

```

```bash
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`

```auto
$ 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

```

```auto
$ 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

```

```auto
$ 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

```

```auto
$ 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 

```

```auto
$ 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](https://github.com/moscajs/mosca) is now dead (replaced by [Aedes](https://github.com/moscajs/aedes))

Why is mosca a dev requirement?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 November 2020 14:15 UTC](https://discourse.nodered.org/t/errors-when-running-npm-install-in-node-red-source-code-install/35156/2 "2020-11-01T14:15:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 November 2020 14:29 UTC](https://discourse.nodered.org/t/errors-when-running-npm-install-in-node-red-source-code-install/35156/3 "2020-11-01T14:29:21Z")

</div>

> [@TotallyInformation](#):
>
> Not clear what or why.

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.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [2 November 2020 03:41 UTC](https://discourse.nodered.org/t/errors-when-running-npm-install-in-node-red-source-code-install/35156/4 "2020-11-02T03:41:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [2 November 2020 16:58 UTC](https://discourse.nodered.org/t/errors-when-running-npm-install-in-node-red-source-code-install/35156/5 "2020-11-02T16:58:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [2 November 2020 17:52 UTC](https://discourse.nodered.org/t/errors-when-running-npm-install-in-node-red-source-code-install/35156/6 "2020-11-02T17:52:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [2 November 2020 21:35 UTC](https://discourse.nodered.org/t/errors-when-running-npm-install-in-node-red-source-code-install/35156/7 "2020-11-02T21:35:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 November 2020 21:35 UTC](https://discourse.nodered.org/t/errors-when-running-npm-install-in-node-red-source-code-install/35156/8 "2020-11-16T21:35:33Z")

</div>

Closed on 16 November 2020 21:35 UTC

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