使用Angular CLI
npm install -g @angular/cli安装:
完毕之后ng serve:
Your global Angular CLI version (7.3.3) is greater than your local version (7.3.0). The local Angular CLI version is used.
To disable this warning use “ng config -g cli.warnings.versionMismatch false”. ** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2019-02-22T08:31:30.608Z Hash: 810be7199f55b6df4b1c Time: 15371ms chunk {main} main.js, main.js.map (main) 38.2 kB [initial] [rendered] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 223 kB [initial] [rendered] chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered] chunk {styles} styles.js, styles.js.map (styles) 1.15 MB [initial] [rendered] chunk {vendor} vendor.js, vendor.js.map (vendor) 4.19 MB [initial] [rendered] i 「wdm」: Compiled successfully. 浏览器里输入localhost:4200,ok了: