TS2307: Cannot find module 'angular2/core' while importing Angular2 on TypeScript

前端 未结 8 1633
庸人自扰
庸人自扰 2021-01-31 03:39

Hi I have a lil bit of Angular 1 background, I am learning Angular 2.

for starting up with Angular 1, only dependency is to add the angular sources either the angu

8条回答
  •  不知归路
    2021-01-31 04:03

    I was able to resolve this issue by adding "moduleResolution" : "node" to my tsconfig.json file

    {
      "compilerOptions": {
        "target": "es5",
        "module": "system",
        "moduleResolution": "node",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false
      },
      "exclude": [
        "node_modules",
        "typings/main.d.ts",
        "typings/main"
      ]
    }
    

提交回复
热议问题