Reputation: 396
I have a problem trying to run my project on localhost:8080 with reload. So when I try and start my project on localhost it gives me this error:
This is not a problem with my project, this exact project was working last week and now none of my projects can run properly. To make sure it wasn't my project I went into the file explorer and opened the index.html file with chrome and it only ran the index.html none of my script being brought in were working. I don't know what to do to fix this. If anyone can help that would be great.
Upvotes: 0
Views: 2315
Reputation: 174
Going back to the previous version works, in the mean time, but will not solve the problem in the long run, and you'll not get the benefits of new fixes, updates, and upgrades.
One example that would cause that warning when called is the function
fs.readFile(path[, options], callback)
Without the callback, the warning would appear.
To prevent the warning and implement the callback would be like for example:
const fs = require('fs');
fs.readFile('./good.txt', 'utf8', function read(err, data) {
if (err) {
throw err;
}
content = data;
// call the next step here
console.log(content); // content display
it
});
the callback function read(), does two things,
Note: encoding is necessary, if you want the file to be human-readable
Upvotes: 1
Reputation: 396
I had node v7.8.0 installed which was causing me problems. I uninstalled that version and installed node v6.10.1 which fixed this weird issue.
Upvotes: 0