TypeScript error in Angular2 code: Cannot find name 'module'

前端 未结 11 1429
梦毁少年i
梦毁少年i 2020-11-30 03:13

I have defined the following Angular2 component:

import {Component} from \'angular2/core\';

@Component({
  selector: \'my-app\',
  moduleId: module.id,
  te         


        
11条回答
  •  天命终不由人
    2020-11-30 03:26

    module.id

    cannot find the name module.

    Follow following steps to resolves this issue,

    step 1: Install node module by using the below command

    npm i @types/node --save
    

    Step 2: modify the file tsconfig.app.json under src/app

    "types": [
        "node"
    ]
    

提交回复
热议问题