Add mathjs to node red

Is it posible til add mathjs to node-red?
I installed mathjs with npm and tried to add/enabled it in the settings.js fil

Started Node-RED graphical event wiring tool.
Error loading settings file: /home/pi/.node-red/settings.js
ReferenceError: mathjs is not defined
at Object. (/home/pi/.node-red/settings.js:175:15)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/usr/lib/node_modules/node-red/red.js:119:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)

Hi @sondre

how did you install mathjs? What command did you run and what directory were you in when you ran it?

What have you then added to your settings.js file to load it?

Installed in the folder for node-red

pi@raspberrypi:~/.node-red $ npm install mathjs

Added this line to the settings file

functionGlobalContext: {

You have missed some quotes:

functionGlobalContext: {
1 Like

Thank you for pointing out that error. It's working now :slight_smile: