I recently installed a new module and added it to my system JS configuration as follows:
// specifying where to look for things using the map object
var map = {
'angular2-notifications': 'node_modules/angular2-notifications',
};
// loading configuration when filename or extension is missing using the packages object
var packages = {
'angular2-notifications': {defaultExtension: 'js'},
};
After importing the module into my component:
import {NotificationsService, SimpleNotificationsComponent} from 'angular2-notifications'
I encountered the following error:
error TS2307: Cannot find module 'notifications'.
This error is related to the preceding import statement.
I found that the module works fine if I delete all references to it, start my app, and then add the imports and directives again while the app is already running.
Why does the error occur when I run npm start
, but everything functions correctly with no errors when the app is already running?