root @ localhost:/ var / www / html / abcd-seed#ng服务 您的全局Angular CLI版本(7.1.2)大于本地版本 版本(6.2.8)。使用本地Angular CLI版本。
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: 2018-12-10T14:35:22.329Z
Hash: 35a983178ac09d7b7950
Time: 25011ms
chunk {main} main.js, main.js.map (main) 1.89 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 673 bytes
[initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.22 kB [entry]
[rendered]
chunk {styles} styles.js, styles.js.map (styles) 311 kB [initial]
[rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 329 kB [initial]
[rendered]
ERROR in node_modules/@angular/common/http/src/response.d.ts(253,21):
error TS1039: Initializers are not allowed in ambient contexts.
node_modules/@angular/common/http/src/response.d.ts(259,19): error
TS1039: Initializers are not allowed in ambient contexts.
node_modules/@angular/core/src/application_init.d.ts(26,21): error
TS1039: Initializers are not allowed in ambient contexts.
node_modules/@angular/core/src/ivy_switch.d.ts(8,54): error TS1254: A
'const' initializer in an ambient context must be a string or numeric
literal.
node_modules/@angular/core/src/ivy_switch.d.ts(9,35): error TS1254: A
'const' initializer in an ambient context must be a string or numeric
literal.
node_modules/@angular/core/src/linker/query_list.d.ts(36,22): error
TS1039: Initializers are not allowed in ambient contexts.
ℹ 「wdm」: Failed to compile.
答案 0 :(得分:0)
只需删除node_modules和package-lock.json并升级我的项目即可。我遵循了这个https://medium.com/@jeroenouw/upgrade-to-angular-6-4520e46c682b