I am attempting to create a hello world app from this developerworks
article:
https://www.ibm.com/developerworks/ibmi/library/i-native-js-app-ibmi-with-nodejs/
step 3 values:
$
node -v
v6.11.5
$
npm -v
3.10.10
$
my js file: called sample.js, CCSID = 37
************Beginning of data**************
var http = require('http');
var ip = "xxx.xxx.xxx.xxx" ;
var port = 53591 ;
var webserver = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World with node\n');
});
webserver.listen(port, ip);
console.log('Server running at http://' + ip + ':' + port);
************End of Data********************
when I tried to run node:
node '/home/gmagnuson/sample.js'
/home/gmagnuson/sample.js:1
(function (exports, require, module, __filename, __dirname) {
���@����@~@�������M}����}]^
^
SyntaxError: Invalid or unexpected token
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
$
As an Amazon Associate we earn from qualifying purchases.