To resolve the ENOENT warning message, you need to add a package. json file in the directory where you run the npm install command. And then run your npm install command again. This time, the warning message should not appear.
It's an abbreviation of Error NO ENTry (or Error NO ENTity), and can actually be used for more than files/directories. It's abbreviated because C compilers at the dawn of time didn't support more than 8 characters in symbols. Follow this answer to receive notifications. edited Jun 4, 2019 at 14:30. community wiki.
Paths specified with a .
are relative to the current working directory, not relative to the script file. So the file might be found if you run node app.js
but not if you run node folder/app.js
. The only exception to this is require('./file')
and that is only possible because require
exists per-module and thus knows what module it is being called from.
To make a path relative to the script, you must use the __dirname
variable.
var path = require('path');
path.join(__dirname, 'path/to/file')
or potentially
path.join(__dirname, 'path', 'to', 'file')
Here the code to use your app.js
input specifies file name
res.download(__dirname+'/'+input);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With