ENOENT Error when WriteFile to public folder in Meteor - node.js

So I'm trying to write a pdf file to the public folder of Meteor to serve the file to the client. I deploy my application with mup.
The public folder is located under /opt/your-app/current/bundle/programs/web.browser/app/charts/.
If I try to use fs.writeFile() in this folder it throws the following error: Error: ENOENT: no such file or directory, open '/opt/your-app/current/bundle/programs/web.browser/app/charts/JjMMiHnyptmEPJz5D.pdf'
When I ssh into the server the folder is available. But the file has not been created. The app runs in a docker container that is deployed with Meteor up.

Related

What path to be used for local files which are in public folder in Next js api function

I am using Jimp NPM module for image processing in NextJs api function which is to use a local font situated in public folder, This is working fine in development server but it is giving me errors when deployed to vercel, error says no such file or directory, I even tried using Jimp.FONT_SANS_64_BLACK but still it is giving me the same error.

File path not found when code is deployed on a remote server

I have the following directory structure for my node/express app:
/
/client_side_code
- object00.png
/server_side_code
- server.js
When running a local server on port 3000, my server.js script accesses object00.png successfully with the following code:
var pathToImage = __dirname + "/../client_side_code/original_object_images";
fs.readdirSync(pathToImage).forEach(function(file,e) {
console.log(file);
});
Now, when I upload my application to a remote server (Heroku), the console says that this path can't be found. Specifically, I get the following error message in the console:
Error: ENOENT: no such file or directory, scandir '/app/server_side_code/../client_side_code/original_object_images
As you can see, the object00.png image can no longer be found. I thought using __dirname would also work on a remote server since it begins a relative path. Any thoughts as how I can allow this image to be accessed when it's hosted on a remote server?

Heroku Error: ENOENT: no such file or directory, stat '/app/index.html'

I deployed my nodejs app to Heroku
My project folder structure is as below
folder structure
Server.js
Server.js code
After deployment I am getting above error as no such file or directory /app/index.html
I tried running run bash command to check folder structure on Heroku but it doesnt show me app folder at root path
Heroku run bash output
wondering why I can't see app folder above where it is coming from?
Appreciate your help.
Your index.html has a caps, you called it Index.html.
If you are using windows just notice you might have to delete Index.html, then push your project without it, then push it again with your file correctly named (index.html).
You are not seeing app/ because you are inside of it.

no such file or directory, scandir '/sql/' issue var sql = new SQLBuilder('SQLServer'); on creating the object of json-sql-builder2 module

I'm getting this below error on deploying my aws lambda package on node 8.10.0 but it works fine in my local windows.
let modules = tools.walk(path.join(__dirname, `../sql/`));
on logging the _dirname it was showing '/' even though its is 'var/task'
lambda uploaded package has src
src/index.js
sql
sql/somemodules
this folders and files inside the uploaded package.
FYI: lambda package has bundled using webpack.
2019-05-09T04:23:22.996Z 6010d98c-2788-4c96-b972-49361876948c Error: ENOENT: no such file or directory, scandir '/sql/'
at Object.fs.readdirSync (fs.js:904:18)
at Object.walk (/var/task/src/index.js:144899:16)
at SQLBuilder._loadModules (/var/task/src/index.js:144709:23)
at new SQLBuilder (/var/task/src/index.js:144298:8)
at handler (/var/task/src/index.js:76189:15)

Iin meteor deploy server Error: ENOENT, no such file or directory

in my meteor application I am using node fs to write the file, but when I deployed my application at meteor.com server then I am getting error in meteor logs.
WARNING Error: ENOENT, no such file or directory 'testaudio/server/uploads/6_40_16_340.pcm'
at Object.fs.openSync (fs.js:432:18)
fs = Meteor.npmRequire('node-fs'); in my server and i mentioned the version in packags.json
I am writting file inside /server/uploads/file_name in my application.
I dont know why I am unable to write the file at server. event I tried with full path by using
fullPath = meteor_bootstrap.serverDir that gives path like :-
/appDir/.meteor/local/build/programs/server

Resources