Knoten (SyntaxError: unexpected identifier ) js-Dateien im terminal

Wenn ich versuchen, eine javascript-Datei über das terminal mit Knoten bekomme ich "SyntaxError: unexpected identifier"


Hier ist mein code gespeichert example.js

JS:

console.log('hello world');


Hier ist das, was in meinem terminal.

HTML:

> Thoms-MacBook-Pro:desktop thomvaladez$ node
> console.log('hi');
hi
undefined
> node example.js
SyntaxError: Unexpected identifier
    at Object.exports.createScript (vm.js:44:10)
    at REPLServer.defaultEval (repl.js:117:23)
    at bound (domain.js:254:14)
    at REPLServer.runBound [as eval] (domain.js:267:12)
    at REPLServer.<anonymous> (repl.js:279:12)
    at REPLServer.emit (events.js:107:17)
    at REPLServer.Interface._onLine (readline.js:214:10)
    at REPLServer.Interface._line (readline.js:553:8)
    at REPLServer.Interface._ttyWrite (readline.js:830:14)
    at ReadStream.onkeypress (readline.js:109:10)

Knoten reagiert auf Befehle und code, aber ich kann keine Dateien öffnen. Weiß jemand, was das Problem sein kann?

Schreibe einen Kommentar