node application getting "Error: EACCES: permission denied, mkdir '.tmp' - node.js

I am running node-red on my raspberry pi and am trying to get a node that I wrote myself working on it. The node works fine on my windows PC but I haven't been able to get it working on my pi yet.
My node uses mailin to setup an SMTP server but I don't think it's an issue with that package.
mailin is trying to create a temporary folder but it obviously doesn't have permissions. How do I give node the permissions it needs to be able to create this folder?
full error:
5 Apr 20:06:22 - [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
Many Thanks

The problem here was that mailin was trying to create a temp folder within the root folder for node which was not allowed. Looking at the code for mailin though I was able to pass a different folder to use for temporary files. I did this by adding a tmp property to the config object and set it to os.tempdir()/mailin

Related

Ember build failed

I'm trying run an Ember project locally : https://github.com/cosmicjs/ember-real-estate-website?files=1. I'm using pycharm 2017 using git-bash as my terminal in win7. I have npm , node and ember installed . In pycharm my project looks like the screenshot.
After switching to the cosmic-real-estate folder:
$ ember build
Running without permission to symlink will degrade build performance.
See http://ember-cli.com/user-guide/#windows for details.
cleaning up...
Build failed.
The Broccoli Plugin: [Funnel: Funnel: index.html] failed with:
Error: EISDIR: illegal operation on a directory, symlink 'e:\ember-real-estate-website\cosmic-real-estate\app' -> 'e:\ember-real-estate-website\cosmic-real-estate\tmp\funnel-input_base_path-ZStiRJkX.tmp'
at Error (native)
at Object.fs.symlinkSync (fs.js:1069:18)
at symlinkWindows (e:\ember-real-estate-website\cosmic-real-estate\node_modules\symlink-or-copy\index.js:123:18)
at symlinkOrCopySync (e:\ember-real-estate-website\cosmic-real-estate\node_modules\symlink-or-copy\index.js:63:5)
at e:\ember-real-estate-website\cosmic-real-estate\node_modules\broccoli-plugin\read_compat.js:86:11
at tryCatch (e:\ember-real-estate-website\cosmic-real-estate\node_modules\rsvp\dist\rsvp.js:539:12)
at invokeCallback (e:\ember-real-estate-website\cosmic-real-estate\node_modules\rsvp\dist\rsvp.js:554:13)
at publish (e:\ember-real-estate-website\cosmic-real-estate\node_modules\rsvp\dist\rsvp.js:522:7)
at flush (e:\ember-real-estate-website\cosmic-real-estate\node_modules\rsvp\dist\rsvp.js:2414:5)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
The broccoli plugin was instantiated at:
at Funnel.Plugin (e:\ember-real-estate-website\cosmic-real-estate\node_modules\broccoli-plugin\index.js:7:31)
at new Funnel (e:\ember-real-estate-website\cosmic-real-estate\node_modules\broccoli-funnel\index.js:58:10)
at EmberApp._rawAppIndex (e:\ember-real-estate-website\cosmic-real-estate\node_modules\ember-cli\lib\broccoli\ember-app.js:694:12)
at EmberApp.index (e:\ember-real-estate-website\cosmic-real-estate\node_modules\ember-cli\lib\broccoli\ember-app.js:678:20)
at EmberApp.toArray (e:\ember-real-estate-website\cosmic-real-estate\node_modules\ember-cli\lib\broccoli\ember-app.js:1661:12)
at EmberApp.toTree (e:\ember-real-estate-website\cosmic-real-estate\node_modules\ember-cli\lib\broccoli\ember-app.js:1684:38)
at module.exports (e:\ember-real-estate-website\cosmic-real-estate\ember-cli-build.js:26:14)
at Builder.setupBroccoliBuilder (e:\ember-real-estate-website\cosmic-real-estate\node_modules\ember-cli\lib\models\builder.js:56:19)
at new Builder (e:\ember-real-estate-website\cosmic-real-estate\node_modules\ember-cli\lib\models\builder.js:30:10)
at BuildTask.run (e:\ember-real-estate-website\cosmic-real-estate\node_modules\ember-cli\lib\tasks\build.js:15:19)
There is a new node_modules folder visible as well:
How can I get this working?

jsreport failing on looking up extensions

So I recently started working on a linux machine (ubuntu 16.04) and followed the installation instructions here http://jsreport.net/downloads/. When I run npm start --production I get
2016-09-13T16:51:57.134Z - info: Initializing jsreport in production mode using configuration file prod.config.json
2016-09-13T16:51:57.138Z - info: Setting process based strategy for rendering. Please visit http://jsreport.net/learn/configuration for information how to get more performance.
2016-09-13T16:51:57.146Z - info: Searching for available extensions in /home/ross/rifiniti/optimo_ui/
2016-09-13T16:51:57.152Z - info: Extensions location cache not found, crawling directories
2016-09-13T16:51:57.317Z - error: Error occured during reporter init Error: ENOENT, no such file or directory '/home/ross/rifiniti/optimo_ui/ember/tmp/tree_merger-tmp_dest_dir-2yGnPLMA.tmp/optimo-ui/config'
at Error (native)
at Object.fs.statSync (fs.js:801:18)
at /home/ross/rifiniti/optimo_ui/node_modules/jsreport/node_modules/jsreport-core/lib/util/util.js:51:21
at Array.forEach (native)
at Object.exports.walkSync (/home/ross/rifiniti/optimo_ui/node_modules/jsreport/node_modules/jsreport-core/lib/util/util.js:44:10)
at /home/ross/rifiniti/optimo_ui/node_modules/jsreport/node_modules/jsreport-core/lib/extensions/locationCache.js:50:20
From previous event:
at /home/ross/rifiniti/optimo_ui/node_modules/jsreport/node_modules/jsreport-core/lib/reporter.js:90:8
From previous event:
at Reporter.init (/home/ross/rifiniti/optimo_ui/node_modules/jsreport/node_modules/jsreport-core/lib/reporter.js:69:30)
at Reporter.reporter.init (/home/ross/rifiniti/optimo_ui/node_modules/jsreport/lib/extendInit.js:8:21)
at Object.<anonymous> (/home/ross/rifiniti/optimo_ui/server.js:1:85)
And I have no idea why. It was working fine on mac but now it is looking for this non-existent tmp file in ember. I'm at a loss, any help would be greatly appreciated!
SOLVED!
All I had to do was remove the tmp directory in ember and it worked.

How to release resource \AppData\Local\Temp\shelljs_60d55c70cdc922162f4b without removing antivirus or reinstalling node?

I'm running Ionic2 to build windows app. but it is giving me following error:
shell.js: internal error
Error: EBUSY: resource busy or locked, open 'C:\Users\edge\AppData\Local\Temp\shelljs_60d55c70cdc922162f4b'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.writeFileSync (fs.js:1333:33)
at execSync (C:\Users\edge\AppData\Roaming\npm\node_modules\ionic\node_modules\shelljs\src\exec.js:67:57)
at Object._exec (C:\Users\edge\AppData\Roaming\npm\node_modules\ionic\node_modules\shelljs\src\exec.js:179:12)
at Object.exec (C:\Users\edge\AppData\Roaming\npm\node_modules\ionic\node_modules\shelljs\src\common.js:168:23)
at Object.gatherGulpInfo (C:\Users\edge\AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\lib\info.js:201:24)
at Object.t (C:\Users\edge\AppData\Roaming\npm\node_modules\ionic\lib\utils\stats.js:148:15)
at Object.run (C:\Users\edge\AppData\Roaming\npm\node_modules\ionic\lib\cli.js:135:16)
at Object.<anonymous> (C:\Users\edge\AppData\Roaming\npm\node_modules\ionic\bin\ionic:13:10)
I sow a same error:
Ionic run android - Internal Error
But I don't want to remove my antivirus and reinstall nodeJS.
But when I restart my system and immediately after I run the command It works(Possibly some process takes time to execute which one access this resource)
Snapshot of process running on my system are as follows:
I faced the same issue , and resolved it by uninstalling bytefence anti malware . it actually use the same resource mentioned above .(I checked in dell laptop)

watchman.plist permission denied when running a react-native initial project

I'm start using react-native and I followed the tutorials on the website, but when running the example project, it returned some error messages on the terminal:
Looking for JS files in
/Users/username/Desktop/nativeTest/BookSearch
[06:03:00] <START> Building Dependency Graph
[06:03:00] <START> Crawling File System
[06:03:00] <START> Loading bundles layout
[06:03:00] <END> Loading bundles layout (0ms)
React packager ready.
2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied
2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied
Watchman: watchman--no-pretty get-sockname returned with exit code null 2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied
ERROR watchman--no-pretty get-sockname returned with exit code null 2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied
Error: watchman--no-pretty get-sockname returned with exit code null 2015-12-13T06:03:01,281: [cli] Failed to open /Users/username/Library/LaunchAgents/com.github.facebook.watchman.plist for write: Permission denied
at ChildProcess.<anonymous> (/Users/username/Desktop/nativeTest/BookSearch/node_modules/fb-watchman/index.js:194:18)
at emitTwo (events.js:88:13)
at ChildProcess.emit (events.js:173:7)
at maybeClose (internal/child_process.js:819:16)
at Socket.<anonymous> (internal/child_process.js:320:11)
at emitOne (events.js:78:13)
at Socket.emit (events.js:170:7)
at Pipe._onclose (net.js:470:12)
See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.
~
Process terminated. Press <enter> to close the window
I tried to chmod com.github.facebook.watchman.plist but actually there's no such file there. Maybe I should change the path of the file?
Other things I've tried:
brew update
brew upgrade watchman
brew uninstall watchman && brew install --HEAD watchman
Restart and reinit the project
Packages Version (if needed):
node: v5.2.0
watchman: v4.2.0
Current user do not have permission on folder /Users/[username]/Library/LaunchAgents.
Use the following command to fix this:
$ sudo chown $(whoami) /Users/$(whoami)/Library/LaunchAgents
Make sure that /Users/username/Library and /Users/username/Library/LaunchAgents are owned by username and have the correct permissions; here's how mine look:
$ ls -ld ~/Library
drwx------+ 57 wez users 1938 Nov 6 07:49 /Users/wez/Library
$ ls -ld ~/Library/LaunchAgents
drwxr-xr-x 3 wez users 102 Dec 11 16:13 /Users/wez/Library/LaunchAgents
$ ls -l ~/Library/LaunchAgents/com.github.facebook.watchman.plist
-rw-r--r-- 1 wez users 1545 Dec 11 16:13 /Users/wez/Library/LaunchAgents/com.github.facebook.watchman.plist
Also make sure that you don't run watchman as root or via sudo.

install mongodb with node.js: Cannot read property 'arbiterOnly' of undefined

I try to install remotely node.js + now.js + mongoDB on a newly created Ubuntu 11.04 system (64 bits).
I created a structure like this:
/home/xxx/server.js
/home/xxx/node/
/home/xxx/node_modules/now/
/home/xxx/http/index.html
No problem with node.js and now.js, it works just fine but I have a hard time trying to install and setup mongoDB.
I went to the root of my machine and installed Mongodb this way:
cd
sudo apt-get install mongodb
I don't know if I should but I created a data/db folder like this:
cd
mkdir /data/db
chown `id -u` /data/db
When done, I installed the mongodb driver for node on the appropriate folder:
cd /home/xxx/
npm install mongodb
Then I started the node server. My static page appears as it should but this is what I get on the ssh terminal after about 10 seconds:
[TypeError: Cannot read property 'arbiterOnly' of undefined]
TypeError: Cannot read property 'arbiterOnly' of undefined
at /home/xxx/node_modules/mongodb/lib/mongodb/connection/server.js:558:22
at [object Object].checkoutReader (/home/xxx/node_modules/mongodb/lib/mongodb/connection/server.js:575:16)
at /home/xxx/node_modules/mongodb/lib/mongodb/db.js:1344:79
at Db._executeQueryCommand (/home/xxx/node_modules/mongodb/lib/mongodb/db.js:1555:5)
at Cursor.nextObject (/home/xxx/node_modules/mongodb/lib/mongodb/cursor.js:455:13)
at Array.0 (/home/xxx/node_modules/mongodb/lib/mongodb/cursor.js:162:12)
at EventEmitter._tickCallback (node.js:192:40)
Tue Apr 24 2012 07:12:45 GMT+0200 (CEST) [GET] http://www.verysurf.com/proxyheader.php
error loading file httphttp://www.verysurf.com/proxyheader.php: { [Error: ENOENT, No such file or directory 'httphttp://www.verysurf.com/proxyheader.php']
errno: 33,
code: 'ENOENT',
path: 'httphttp://www.verysurf.com/proxyheader.php' }
What is this 'arbiterOnly' error message about?
What do I do wrong?
I googled this thing but there's not much to find about it.
And that "www.verysurf.com" url at the end of the error message, it's not always the same one. 5 minutes before I got this one (and I didn't change anything, just restarted the node server):
error loading file httphttp://59.53.91.9/proxy/judge.php: { [Error: ENOENT, No such file or directory 'httphttp://59.53.91.9/proxy/judge.php']
errno: 33,
code: 'ENOENT',
path: 'httphttp://59.53.91.9/proxy/judge.php' }
I really don't know what these url's are about.
Any help please?
Thank you.
I don't know why it's triggering that particular error message, but it looks to me like someone is or someones are sniffing your webserver to see if it's an open proxy (which it isn't). Some HTTP servers, notably Apache, are easily misconfigured to proxy any request to a third party:
http://en.wikipedia.org/wiki/Open_proxy
I get the very same message ([TypeError: Cannot read property 'arbiterOnly' of undefined]) when trying to request the database before the connection is fully initialized.
Make sure db.open() has finished (successfully)

Resources