Search code examples
asp.net-coreangular-cliaspnetboilerplate

ng serve error - typescript mismatch version (maybe)


aspnetboilerplate core template 3.3.2

"ng serve" issues this output (below)

additional information:

  • is the error generated from the typescritp mismatch version?
  • my typescript should be 2.6.1 (npm view typescript version)
  • i've tried to: npm install typescript@2.4.0
  • there is another problem?

[ng serve output]

@angular/compiler-cli@4.4.6 requires typescript@'>=2.1.0 <2.4.0' but 2.4.0 was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.

Please run the following command to install a compatible version of TypeScript.

    npm install typescript@'>=2.1.0 <2.4.0'

To disable this warning run "ng set warnings.typescriptMismatch=false".

** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2017-11-16T09:52:15.693Z
Hash: f55af8b09fa2b7f58749
Time: 32705ms
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 483 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 1.09 MB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 1.61 MB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 14.7 MB [initial] [rendered]

WARNING in ./node_modules/abp-ng2-module/node_modules/@angular/core/esm5/core.js
6438:15-36 Critical dependency: the request of a dependency is an expression
    at ImportLazyContextDependency.getWarnings (C:\angular\AbpCore\3.3.2\angular\node_modules\webpack\lib\dependencies\ContextDependency.js:39:18)
    at Compilation.reportDependencyErrorsAndWarnings (C:\angular\AbpCore\3.3.2\angular\node_modules\webpack\lib\Compilation.js:703:24)
    at Compilation.finish (C:\angular\AbpCore\3.3.2\angular\node_modules\webpack\lib\Compilation.js:561:9)
    at applyPluginsParallel.err (C:\angular\AbpCore\3.3.2\angular\node_modules\webpack\lib\Compiler.js:506:17)
    at C:\angular\AbpCore\3.3.2\angular\node_modules\tapable\lib\Tapable.js:289:11
    at _addModuleChain (C:\angular\AbpCore\3.3.2\angular\node_modules\webpack\lib\Compilation.js:507:11)
    at processModuleDependencies.err (C:\angular\AbpCore\3.3.2\angular\node_modules\webpack\lib\Compilation.js:477:14)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
 @ ./node_modules/abp-ng2-module/node_modules/@angular/core/esm5/core.js
 @ ./node_modules/abp-ng2-module/src/multi-tenancy/abp-multi-tenancy.service.ts
 @ ./src/shared/session/app-session.service.ts
 @ ./src/root.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts

WARNING in ./node_modules/abp-ng2-module/node_modules/@angular/core/esm5/core.js
6458:15-102 Critical dependency: the request of a dependency is an expression
    at ImportLazyContextDependency.getWarnings (C:\angular\AbpCore\3.3.2\angular\node_modules\webpack\lib\dependencies\ContextDependency.js:39:18)
    at Compilation.reportDependencyErrorsAndWarnings (C:\angular\AbpCore\3.3.2\angular\node_modules\webpack\lib\Compilation.js:703:24)
    at Compilation.finish (C:\angular\AbpCore\3.3.2\angular\node_modules\webpack\lib\Compilation.js:561:9)
    at applyPluginsParallel.err (C:\angular\AbpCore\3.3.2\angular\node_modules\webpack\lib\Compiler.js:506:17)
    at C:\angular\AbpCore\3.3.2\angular\node_modules\tapable\lib\Tapable.js:289:11
    at _addModuleChain (C:\angular\AbpCore\3.3.2\angular\node_modules\webpack\lib\Compilation.js:507:11)
    at processModuleDependencies.err (C:\angular\AbpCore\3.3.2\angular\node_modules\webpack\lib\Compilation.js:477:14)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
 @ ./node_modules/abp-ng2-module/node_modules/@angular/core/esm5/core.js
 @ ./node_modules/abp-ng2-module/src/multi-tenancy/abp-multi-tenancy.service.ts
 @ ./src/shared/session/app-session.service.ts
 @ ./src/root.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts

ERROR in Error: Metadata version mismatch for module C:/angular/AbpCore/3.3.2/angular/node_modules/abp-ng2-module/node_modules/@angular/http/http.d.ts, found version 4, expected 3, resolving symbol ABP_HTTP_PROVIDER in C:/angular/AbpCore/3.3.2/angular/node_modules/abp-ng2-module/src/abp.module.ts, resolving symbol RootModule in C:/angular/AbpCore/3.3.2/angular/src/root.module.ts, resolving symbol RootModule in C:/angular/AbpCore/3.3.2/angular/src/root.module.ts
    at Error (native)
    at syntaxError (C:\angular\AbpCore\3.3.2\angular\node_modules\@angular\compiler\bundles\compiler.umd.js:1729:34)
    at simplifyInContext (C:\angular\AbpCore\3.3.2\angular\node_modules\@angular\compiler\bundles\compiler.umd.js:24979:23)
    at StaticReflector.simplify (C:\angular\AbpCore\3.3.2\angular\node_modules\@angular\compiler\bundles\compiler.umd.js:24991:13)
    at StaticReflector.annotations (C:\angular\AbpCore\3.3.2\angular\node_modules\@angular\compiler\bundles\compiler.umd.js:24418:41)
    at _getNgModuleMetadata (C:\angular\AbpCore\3.3.2\angular\node_modules\@angular\compiler-cli\src\ngtools_impl.js:138:31)
    at _extractLazyRoutesFromStaticModule (C:\angular\AbpCore\3.3.2\angular\node_modules\@angular\compiler-cli\src\ngtools_impl.js:109:26)
    at Object.listLazyRoutesOfModule (C:\angular\AbpCore\3.3.2\angular\node_modules\@angular\compiler-cli\src\ngtools_impl.js:53:22)
    at Function.NgTools_InternalApi_NG_2.listLazyRoutes (C:\angular\AbpCore\3.3.2\angular\node_modules\@angular\compiler-cli\src\ngtools_api.js:91:39)
    at AotPlugin._getLazyRoutesFromNgtools (C:\angular\AbpCore\3.3.2\angular\node_modules\@ngtools\webpack\src\plugin.js:241:66)
    at _donePromise.Promise.resolve.then.then.then.then.then (C:\angular\AbpCore\3.3.2\angular\node_modules\@ngtools\webpack\src\plugin.js:495:24)
    at process._tickCallback (internal/process/next_tick.js:109:7)

webpack: Failed to compile.

Solution

  • I had the same issue. Seems that will be a problem with "abp-ng2-module".

    So force npm to install abp-ng2-module v1.2.0.

    • In package.json dependencies replace "abp-ng2-module": "^1.2.0" with "abp-ng2-module": "1.2.0"
    • Delete node_modules folder and package.json.lock file
    • Run npm install
    • Run ng serve