I'm trying to write a web application with ExpressJS and Angular2. Zone.js appears to be trying (unsuccessfully) to load some @angular libraries, but I'm not sure how to approach fixing it.
My process so far looks like this:
- Copied into my build/node_modules folder:
- core-js/client/shim.min.js
- zone.js/dist/zone.js
- reflect-metadata/Reflect.js
- systemjs/dist/system.src.js
- Map /scripts URLs to node_modules folder in ExpressJS
On my index page, source the above libraries in script tags and load SystemJS:
System.config({ packages: { app: { defaultExtension: 'js' }, rxjs: { defaultExtension: 'js' } }, map: { 'rxjs': '/scripts/rxjs', '@angular': '/scripts/@angular' } }) System.import('/app/bootstrap') .then(null, console.error.bind(console))
And finally, my bootstrap.ts file:
import { bootstrap } from '@angular/platform-browser-dynamic' import { Component } from '@angular/core' @Component({ selector: 'testing-ang2', template: '<span>WIP</span>' }) export class Ang2TestComponent {} bootstrap(Ang2TestComponent)
However, when I run this, I get the following errors:
zone.js:101 GET http://localhost:3000/scripts/@angular/platform-browser-dynamic/ 404 (Not Found)
zone.js:323 Error: (SystemJS) Error: XHR error (404 Not Found) loading http://localhost:3000/scripts/@angular/platform-browser-dynamic
zone.js:101 GET http://localhost:3000/scripts/@angular/core/ 404 (Not Found)
I've tried copying the @angular library into my build/node_modules and adding the index.js file from each of the folders listed into <script>
tags on my main page, but that doesn't make any difference.
Could anyone suggest a way to fix this?