typescript - Angular 2 - Can't find module angular/core -
i'm coming here , asking question has been answered in post, solutions don't work. so, i'm creating new angular2 app quickstart folder of angular website.
i've done npm install
, okay, have node_modules folder @ root.
but, when i'm doing ng serve
, error got :
error in angular/src/app/app.component.ts (1,27): cannot find module '@angular/core'. error in angular/src/app/app.component.ts (8,14): experimental support decorators feature subject change in future release. set 'experimentaldecorators' option remove warning. error in angular/src/app/app.module.ts (1,31): cannot find module '@angular/platform-browser'. error in angular/src/app/app.module.ts (2,26): cannot find module '@angular/core'. error in angular/src/app/app.module.ts (16,14): experimental support decorators feature subject change in future release. set 'experimentaldecorators' option remove warning. error in angular/src/main.ts (1,32): cannot find module '@angular/core'. error in angular/src/main.ts (2,40): cannot find module '@angular/platform-browser-dynamic'.
this folder structure :
and tsconfig.json :
{ "compileroptions": { "target": "es5", "module": "commonjs", "moduleresolution": "node", "sourcemap": true, "emitdecoratormetadata": true, "experimentaldecorators": true, "lib": [ "es2015", "dom" ], "noimplicitany": true, "suppressimplicitanyindexerrors": true, "typeroots": [ "../node_modules/@types/" ] }, "compileonsave": true, "exclude": [ "node_modules/*", "**/*-aot.ts" ] }
edit :
this app.module.ts
:
import { browsermodule } '@angular/platform-browser'; import { ngmodule } '@angular/core'; import { appcomponent } './app.component'; @ngmodule({ declarations: [ appcomponent ], imports: [ browsermodule ], providers: [], bootstrap: [appcomponent] }) export class appmodule { }
i went through tsconfig.json file , found tsconfig.json differs mine. "include" & "exclude" key values pairs different. have look.
tsconfig.json
{ "compileroptions": { "allowsyntheticdefaultimports": true, "declaration": false, "emitdecoratormetadata": true, "experimentaldecorators": true, "lib": [ "dom", "es2015" ], "module": "es2015", "moduleresolution": "node", "sourcemap": true, "target": "es5" }, "include": [ "src/**/*.ts" ], "exclude": [ "node_modules" ], "compileonsave": false, "atom": { "rewritetsconfig": false } }
wiki
Comments
Post a Comment