Welcome tag moderator AKA Unofficial DEV cheerleader. While most of my friends are found on SnapChat or Tic-Toc, you can find me here. And I OOP, but I’m not a VSCO girl.
console.log('Server running at 127.0.0.1:8124/');
server.setTimeout(100000);
Unless you mean that the path should be specified like this in the main.js,
module.exports = function(C:\Users\myname\Documents\Node_apps\internet\example_exec) {
I thought it is generic.
This is the bin.js:
const prettyprint = require('.') /* the current working directory so that means main.js because of package.json /
let theFile = process.argv[2] / what the user enters as first argument */
console.log(
prettyprint(theFile)
)
console.log(require('.')(process.argv[2]))
There is no mistake at the path, the path of the terminal is correct
Do you see the attachment of the path I uploaded?
All the files are in : C:\Users\myname\Documents\Node_apps\internet\example_exec
The folder contains:
bin.js
main.js
package.json
prettyprint.exe
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Looks like you missed a path parameter somewhere.
Hi, thank you for your message. I m running the file from this path
C:\Users\myname\Documents\Node_apps\internet\example_exec> prettyprint.exe
this is my main.js , I simply pasted the code:
module.exports = filePath => JSON.stringify(JSON.parse(require('fs').readFileSync(filePath).toString()), false, 3)
var http = require('http');
var server= http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8124);
console.log('Server running at 127.0.0.1:8124/');
server.setTimeout(100000);
Unless you mean that the path should be specified like this in the main.js,
module.exports = function(C:\Users\myname\Documents\Node_apps\internet\example_exec) {
I thought it is generic.
This is the bin.js:
const prettyprint = require('.') /* the current working directory so that means main.js because of package.json /
let theFile = process.argv[2] / what the user enters as first argument */
console.log(
prettyprint(theFile)
)
console.log(require('.')(process.argv[2]))
This is the package.json:
{
"name": "prettyprint",
"version": "0.0.1",
"description": "Pretty print a JSON file.",
"main": "main.js",
"bin": "bin.js",
"author": "anybody",
"license": "MIT"
}
There is no mistake at the path, the path of the terminal is correct
Do you see the attachment of the path I uploaded?
All the files are in : C:\Users\myname\Documents\Node_apps\internet\example_exec
The folder contains:
bin.js
main.js
package.json
prettyprint.exe