Suddenly nothing works. The only thing I did was adding a new file to the folder “controllers”, and then removed it. What can be wrong? What does it mean?
node/last/test4/controllers/.DS_Store:1
^
module.js:311
throw err;
^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:429:25)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at /Users/henrikpetersson81/node/last/test4/controllers.js:8:13
at Array.forEach (native)
at Object.oncomplete (node/last/test4/controllers.js:6:15)
controllers.js (nothing is changed in this file since it worked):
var fs = require('fs');
module.exports = function(app, service){
fs.readdir(__dirname + '/controllers', function(err, files){
if (err) throw err;
files.forEach(function(file){
var name = file.replace('.js', '');
require('./controllers/' + name)(app, service);
});
});
};
Its because Mac created a file
.DS_STORE. Whats happening is a helper is automatically going through the controllers folder and including them. Node has included it thinking is a controller and crashed because it’s not JavaScript.