Angular2 5 minute install bug - require is not defined

后端 未结 7 1569
一个人的身影
一个人的身影 2020-11-28 12:22

I\'m doing the Angular2 5 minute quick start.

About half way through the tutorial now, I have the following files setup correctly:

  • index.html,
相关标签:
7条回答
  • 2020-11-28 13:22

    OK finally got my 'basic' app to work.

    First my problem was that npm start was not compiling my typescript .ts files.

    From this post, I found an answer here Cannot find external module 'angular2/angular2' - Angular2 w/ Typescript

    I needed to run npm install -g tsd@latest to update my TypeScript definition. Right after that I needed to update the TypeScript Definition (TSD) for Angular2 tsd install angular2.

    After this was done I was still getting errors from my boot.js file.

    Instead of this import {AppComponent} from './app.component'

    I needed to write it like this import {AppComponent} from '../app.component.js'


    Now it works! https://github.com/leongaban/angular2quickstart


    One annoying problem is that npm start still isn't auto compiling the typescript files, so I still have to manually compile each .ts file by hand tsc app.component.ts --module system

    0 讨论(0)
提交回复
热议问题