Error: EACCES: permission denied, mkdir '.tmp' after adding mailin

1,143 views
Skip to first unread message

Giles Roadnight

unread,
May 6, 2016, 1:04:15 AM5/6/16
to Node-RED
Hi All

I wrote a small node that wraps mailin and allows node-red to respond to emails that are sent direct to node-red rather than polling some email server.

My repo:


Mailin Repo:


I got this working no problem at all on my windows desktop but when I install it on my raspberry pi it is not very happy. It seems that it does not have the required permissions to create directories.

After I install the node, add a node to the flow and restart node-red I get the stack trace at the bottom of the email in an infinite reboot loop.

How to I give node-red permission to create the directories?

Note: I am very new to linux and raspbian. The last time I had this problem I broke sudo with a chmod command I found somewhere and had to re-install my pi from scratch!

Thanks for the help.

Welcome to Node-RED
===================
6 May 04:53:53 - [info] Node-RED version: v0.13.4
6 May 04:53:53 - [info] Node.js  version: v4.4.3
6 May 04:53:53 - [info] Linux 4.1.19-v7+ arm LE
6 May 04:53:53 - [info] Loading palette nodes
pi : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/python -u /usr/lib/node_modules/node-red/nodes/core/hardware/nrgpio.py info
pam_unix(sudo:session): session opened for user root by (uid=0)
pam_unix(sudo:session): session closed for user root
warn: Either spamassassin or spamc are not available. Spam score computation is disabled.
6 May 04:54:00 - [info] Settings file  : /home/pi/.node-red/settings.js
6 May 04:54:00 - [info] User directory : /home/pi/.node-red
6 May 04:54:00 - [info] Flows file : /home/pi/.node-red/flows_pi.json
6 May 04:54:00 - [info] Server now running at http://127.0.0.1:1880/admin/
6 May 04:54:00 - [info] Starting flows
shell.js: internal error
Error: EACCES: permission denied, mkdir '.tmp'
at Error (native)
at Object.fs.mkdirSync (fs.js:794:18)
at mkdirSyncRecursive (/home/pi/.node-red/node_modules/node-red-contrib-mailin-smtp/node_modules/mailin/node_modules/shelljs/src/mkdir.js:11:8)
at /home/pi/.node-red/node_modules/node-red-contrib-mailin-smtp/node_modules/mailin/node_modules/shelljs/src/mkdir.js:63:7
at Array.forEach (native)
at Object._mkdir (/home/pi/.node-red/node_modules/node-red-contrib-mailin-smtp/node_modules/mailin/node_modules/shelljs/src/mkdir.js:48:8)
at Object.mkdir (/home/pi/.node-red/node_modules/node-red-contrib-mailin-smtp/node_modules/mailin/node_modules/shelljs/src/common.js:186:23)
at Mailin.start (/home/pi/.node-red/node_modules/node-red-contrib-mailin-smtp/node_modules/mailin/lib/mailin.js:73:15)
at new MailinSMTP (/home/pi/.node-red/node_modules/node-red-contrib-mailin-smtp/mailinSMTP.js:15:10)
at createNode (/usr/lib/node_modules/node-red/red/runtime/nodes/flows/Flow.js:276:18)
at Flow.start (/usr/lib/node_modules/node-red/red/runtime/nodes/flows/Flow.js:64:35)
at start (/usr/lib/node_modules/node-red/red/runtime/nodes/flows/index.js:264:29)
at tryCatchReject (/usr/lib/node_modules/node-red/node_modules/when/lib/makePromise.js:845:30)
at runContinuation1 (/usr/lib/node_modules/node-red/node_modules/when/lib/makePromise.js:804:4)
at Fulfilled.when (/usr/lib/node_modules/node-red/node_modules/when/lib/makePromise.js:592:4)
at Pending.run (/usr/lib/node_modules/node-red/node_modules/when/lib/makePromise.js:483:13)
nodered.service: main process exited, code=exited, status=1/FAILURE
Unit nodered.service entered failed state.

Dave C-J

unread,
May 6, 2016, 5:02:19 AM5/6/16
to node...@googlegroups.com
Hi Giles,

well it depends where it is trying to create the directory... from the look of it is trying to create .tmp in the current working directory. Which may well be /  which would and should be blocked :-)...
Maybe look at the variable __dirname - as that may be pointing to the directory where you are installed - which should be under .node-red/node_modules somewhere - which should be owned by the current user and so may have a better chance of being accessible 

Giles Roadnight

unread,
May 6, 2016, 7:43:40 AM5/6/16
to node...@googlegroups.com
Aha - thank you very much. I've fixed it locally.

Turns out that there's a configuration object that I can pass to mailin and tell it where to create it's temporary folder. I temporarily set it to /var/tmp/mailin but it seems that I should probably use os.tmpdir(). Perhaps mailin should do that...



--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages