Node.js is falling! SyntaxError: Unexpected ILLEGAL Token

Suddenly, nothing happens. The only thing I did was add a new file to the “controllers” folder and then delete it. What could 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 has changed in this file):

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);
        });
    });
};
+3
source share
1 answer

Because Mac created the file .DS_STORE(it assumes you used finder to create / delete the file: P)

What happens, the helper automatically goes through the controllers folder and turns them on. I got "Hey, this xyz controller, turn it on." "Here's another controller called .DS_STORE, turn it on"

Node "Woah, ? javascript. , . help help help! , , "

.DS_STORE:)

+6

All Articles