node.js express-coffee Error: ENOENT, no such file or directory - node.js

I installed the latest express-coffee and installed node-config too. I created a simple src/config/default.yaml
Database:
db_host: localhost
db_name: test
In my src/models/index.coffee
config = require('config').Database
console.log "host: #{config.db_host}"
But when trying to start the server with cake dev or even cake build && node app I am getting the following error:
Cannot write runtime.json file Error: ENOENT, no such file or directory
Tried searching for the issue here and on Google but wasn't able to find anything. Even the few hits on just ENOENT or node-config runtime.json haven't been helpful. Anyone else run into this problem before ?

It turns out the problem was where config/default.yaml was located. I had to move this to the root directory of the application. Moving it to the root - config/default.yaml fixed the issue.
The error message wasn't very helpful in figuring out what was going on.

Related

Realm Not Working with Packaged Electron App

I've started the Realm-provided realm-electron-advanced-quickstart found here.
Everything works fine when running in dev, but when I package this with electron-builder, the app does not work. I moved createWindow() to the top of the app.whenReady() function so I could see the debugger, and it showed the following message:
Failed to open realm: Error: illegal operation on a directory
at run (renderer.js:26)
at renderer.js:39
Line 26 is
const realm = new Realm(config);
I suspect this is some sort of path/permissions issue with the .realm file.
In main.js, I changed the path in the realm config to
path.join(app.getPath("home"),"my.realm")
But I could not do so on renderer.js.
I would appreciate any ideas or examples of how this has been implemented before.
I'm running Node v14.15.4.

Running node.js server with mongodb error

I'm still new to node.js and mongodb. Now I'm trying to solve this problem.
I have instructions to run my server without any problems, I follow them and yes my server works. But when I switched the server off then run it again I face this bug:
[vagrant#localhost ~]$ node /opt/inapsrv/app/app.js
app-api listening at http://0.0.0.0:7000
/opt/inapsrv/node_modules/fileupload/lib/modules/file.js:23
throw error
^
Error: ENOENT, mkdir 'data/imagex/'
And here is the line of the directory above taken from app.js file:
var imagePath = 'data/imagex/';
I tried to:
make vagrant and mongo users as super users and they have the root permissions.
to run "sudo node /opt/inapsrv/app/app.js"
run "forever /opt/inapsrv/app/app.js"
and it didn't work.
I don't know why it successfully ran the first time, and then it didn't!
Any help?
I suspect you're using node module fileupload for the upload job. The source code fragment in fileupload that throws your error can be found here.
The problem with the code used in fileupload module is that it does not create recursive directories since fs.mkdir is used. To fix your issue try to create the upload directory or at least data upfront. You could do this by a npm script, in app.js using the mkdirp or simply by a shell script.
The problem described is not related to mongodb or mongoose.

node.js & pdfjs 'Unknown file open flag'

I have pdfjs installed running on node.js started with nohup. I am able to start node fine and port 81 is open in the firewall. As soon as I attempt to go to it in the browser it logs the following error in the nohup.out log and node.js stops. The crazy bit is that I have this working on a temporary server that was created from an image of this one to insulate the live server while a worked all this out. Now I can't seem to replicate the success I had. I can supply the code from specific files if it would be helpful, just let me know which ones.
Server running at http://mydomain.com:81/
fs.js:186
throw new Error('Unknown file open flag: ' + flag);
^
Error: Unknown file open flag: rs
at stringToFlags (fs.js:186:13)
at Object.open (fs.js:224:44)
at new <anonymous> (fs.js:1062:6)
at Object.createReadStream (fs.js:1010:10)
at serveRequestedFile (/var/path/to/tools/pdfjs/test/webserver.js:211:23)
at Object.statFile [as oncomplete] (/var/path/to/tools/pdfjs/test/webserver.js:157:7)
Solved: Reinstalling node.js was the solution. If people encounter this error, it is likely that node either isn't installed or wasn't installed successfully. Try installing/reinstalling to correct.

NodeJS: forever.js throws binding error : EROFS read only file system

Okay, so I am using nodejitsu's forever(v0.11.1) module to keep my NodeJS(v0.10.28) + expressJS(3.5.1) server running on VPS(CentOS-6.4). Everything was working smoothly untill recently when I started getting following error while running command: forever start server.js As soon as I run this command I got the following error:
I tried to see the file: ls - l /root/.forever/tVYM.log, No such file was found
When I tried to start my node server using pm2, I got the following error:
I don't understand why is this happening even if I am root(su) user. Also, if I try to edit my server.js file, CentOS won't let me edit file and warns me about insufficient privilege.
But when I rebooted VPS and used forever, things were okay again but after some time, my server went down again and when I used forever to run my node app, forever threw the same error. I just can not see reason behind this. Thanks in advance

ENOENT error using nodejs on heroku

I'm getting an ENOENT error on my heroku app, preventing it from starting up:
Error: ENOENT, open '/app/log/production.log'
This file / dir (app/log) does exist however...
So I'm not sure what's going on?
I ended up disabling 'quiet' mode to stop writing logs to disk:
app.disable('quiet');
This seems to of resolved it

Resources