×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Dont use CCSID 37 for IFS files. Use 1252, 1208 or 819.

37 is EBCDIC. Node is ASCII.




On Tue, Apr 10, 2018 at 10:36 AM, Gerald Magnuson <
gmagqcy.midrange@xxxxxxxxx> wrote:

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)

$
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.