Angular2 Tutorial (Tour of Heroes): Cannot find module 'angular2-in-memory-web-api'

前端 未结 29 2303
青春惊慌失措
青春惊慌失措 2020-11-29 06:25

I have followed the Tutorial. After changing app/maint.ts in the Http chapter I get the error when starting the app via command line:

ap

29条回答
  •  时光说笑
    2020-11-29 06:46

    The simplest solution I could think of was to install the package with npm and restart the server:

    npm install angular-in-memory-web-api --save
    

    I almost installed the angular2-in-memory-web-api package, but the npm page says:

    All versions after 0.0.21 are (or soon will be) shipped under angular-in-memory-web-api.

    Note: This solution worked for a project that was created with the CLI tools, which does not list the package as a dependency, and might not solve the problem for projects that were created with the Quickstart seed, which does list the package as a dependency.

提交回复
热议问题