echo "console.log('Test success!')" > app.js
In Powershell geschrieben Dateien echo Befehl funktionieren nicht mit NodeJS
node app
Läuft auf Linux in Ordnung. Powershell erzeugt jedoch die folgende Fehlermeldung:
~\apps\test\app.js:1
(function (exports, require, module, __filename, __dirname) { ��c
^
SyntaxError: Invalid or unexpected token
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:528:28)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
Auf der anderen Seite, wenn ich echo > app.js
war, dann Eingang console.log('Test success!')
aus einem Texteditor. node app
läuft überall gut.
Wie kommt es?
Meine beste Vermutung: In PowerShell scheint Echo Hexadezimalzahlen und nicht UTF-8 zu machen.
Spot auf! Überprüft mit 'file *' in bash. Vielen Dank! – MarbinJavier