Cannot find module @angular/core + angular2

后端 未结 4 1866
旧时难觅i
旧时难觅i 2021-01-03 04:45

I am trying to create an Angular 2 application using Typescript in Visual Studio 2015. I have installed npm on my machine. When I compile my application , I am getting error

4条回答
  •  天涯浪人
    2021-01-03 04:52

    You first need to add typings at global level as below.

    npm install -g typings
    

    Then create typings.json using below command.

    typings init
    

    Paste below code in typings.json

    {
      "name": "ng2-application",
      "globalDependencies": {
        "core-js": "registry:dt/core-js#0.0.0+20160725163759",
        "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
        "node": "registry:dt/node#6.0.0+20160909174046"
      }
    }
    

    Now you need to add below code in tsconfig.json

     "compilerOptions": {
            "moduleResolution": "node"
           }
    

    After doing above steps you will able to get definitions on F12.

提交回复
热议问题