node.js - Angular2 with NodeJS and Typescript error -
i have attempting set simple application in angular2, nodejs , typescript having errors getting angular2 application error instantiate. getting following errors:
es6-shim.js:1 uncaught syntaxerror: unexpected token < angular2-polyfills.js:1 uncaught syntaxerror: unexpected token < system.src.js:1 uncaught syntaxerror: unexpected token < rx.js:1 uncaught syntaxerror: unexpected token < angular2.dev.js:1 uncaught syntaxerror: unexpected token < http.dev.js:2 uncaught referenceerror: system not defined(anonymous function) @ http.dev.js:2 (index):15 uncaught referenceerror: system not defined
i unsure why happening? seems issue index.html file calls of angular2 script dependencies , instantiates systemjs functionality. here file:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>angular 2 quick start</title> <base href="/"/> <script src="../node_modules/es6-shim/es6-shim.js"></script> <script src="../node_modules/angular2/bundles/angular2-polyfills.js"></script> <script src="../node_modules/systemjs/dist/system.src.js"></script> <script src="../node_modules/rxjs/bundles/rx.js"></script> <script src="../node_modules/angular2/bundles/angular2.dev.js"></script> <script src="https://code.angularjs.org/2.0.0-beta.0/http.dev.js"></script> <script> system.config({ packages: { app: { format: 'register', defaultextension: 'js' } } }); system.import('app/app') .then(null, console.error.bind(console)); </script> </head> <body> <my-app>loading...</my-app> </body> </html>
my app.ts file in relation index.html file in folder called app correct.
can shed light why getting error?i thinking might systemjs error can't figure out!
here picture of file structure.
here nodejs entry-point file:
var express = require('express'); var path = require('path'); var cookieparser = require('cookie-parser'); var bodyparser = require('body-parser'); var logger = require('morgan'); var port = process.env.port || 3006; var app = express(); // view engine setup app.set('views', path.join('./client')); app.set('view engine', 'jade'); app.use(logger('dev')); app.use(bodyparser.json()); app.use(bodyparser.urlencoded({ extended: false })); app.use(cookieparser()); app.use('/app', express.static(path.resolve(__dirname, 'app'))); app.use('/libs', express.static(path.resolve(__dirname, 'libs'))); var renderindex = function (req, res) { res.sendfile(path.resolve('./client/index.html')); }; app.get('/*', renderindex); var server = app.listen(port, function () { var host = server.address().address; var port = server.address().port; console.log('this express app listening on port:' + port); });
thanks
Comments
Post a Comment