# Use npm in node-red

**URL:** https://discourse.nodered.org/t/use-npm-in-node-red/27135
**Category:** General
**Created:** [23 May 2020 12:57 UTC](https://discourse.nodered.org/t/use-npm-in-node-red/27135 "2020-05-23T12:57:08Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![cigno](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cigno/32/91812_2.png) [@cigno](https://discourse.nodered.org/u/cigno)
#### Post date: [23 May 2020 12:57 UTC](https://discourse.nodered.org/t/use-npm-in-node-red/27135/1 "2020-05-23T12:57:08Z")

</div>

Hi everyone I would like to use this npm library but it gives me this error.

 ![Annotazione 2020-05-23 145525](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/f/7fb06fb9b8f7f5c247564386985b46d11544124f.png)

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [23 May 2020 12:59 UTC](https://discourse.nodered.org/t/use-npm-in-node-red/27135/2 "2020-05-23T12:59:23Z")

</div>

Hi Cigno, you can’t require npm libraries directly in the function node. Please take a look at functionGlobalContext in the settings.js file. Normally I paste in a link to the docs here but I’m afraid you’ve to search for it yourself today. 🤒

---

<div class="post-metadata">

### Author: ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)
#### Post date: [23 May 2020 13:07 UTC](https://discourse.nodered.org/t/use-npm-in-node-red/27135/3 "2020-05-23T13:07:11Z")

</div>

[https://nodered.org/docs/user-guide/writing-functions#loading-additional-modules](https://nodered.org/docs/user-guide/writing-functions#loading-additional-modules)

---

<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: [23 May 2020 22:03 UTC](https://discourse.nodered.org/t/use-npm-in-node-red/27135/4 "2020-05-23T22:03:45Z")

</div>

Just a question: Why not use the [node-red-node-email](https://flows.nodered.org/node/node-red-node-email) node?

---

<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: [22 June 2020 22:03 UTC](https://discourse.nodered.org/t/use-npm-in-node-red/27135/5 "2020-06-22T22:03:51Z")

</div>

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