Angular2 import issue when app.component.ts renamed to app.ts

I was having a go at Angular2 with Typescript.

Following the 5 min QuickStart Tutorial when we create file app.component.ts, i tried renaming it to app.ts.

So to include this file i have to update the import statement in main.ts

Original statement: import {AppComponent} from './app.component';

Now if i change this to import {AppComponent} from './app'; it doesn’t work.

What am i doing wrong here ?

Edit: Error message logged in npm-debug.log

19 silly fetchPackageMetaData Error: Registry returned 404 for GET on https://registry.npmjs.org/ang2
19 silly fetchPackageMetaData     at makeError (C:UsersManmeetAppDataRoamingnpmnode_modulesnpmnode_modulesnpm-registry-clientlibrequest.js:264:12)
19 silly fetchPackageMetaData     at CachingRegistryClient.<anonymous> (C:UsersManmeetAppDataRoamingnpmnode_modulesnpmnode_modulesnpm-registry-clientlibrequest.js:242:14)
19 silly fetchPackageMetaData     at Request._callback (C:UsersManmeetAppDataRoamingnpmnode_modulesnpmnode_modulesnpm-registry-clientlibrequest.js:172:14)
19 silly fetchPackageMetaData     at Request.self.callback (C:UsersManmeetAppDataRoamingnpmnode_modulesnpmnode_modulesrequestrequest.js:199:22)
19 silly fetchPackageMetaData     at emitTwo (events.js:100:13)
19 silly fetchPackageMetaData     at Request.emit (events.js:185:7)
19 silly fetchPackageMetaData     at Request.<anonymous> (C:UsersManmeetAppDataRoamingnpmnode_modulesnpmnode_modulesrequestrequest.js:1036:10)
19 silly fetchPackageMetaData     at emitOne (events.js:95:20)
19 silly fetchPackageMetaData     at Request.emit (events.js:182:7)
19 silly fetchPackageMetaData     at IncomingMessage.<anonymous> (C:UsersManmeetAppDataRoamingnpmnode_modulesnpmnode_modulesrequestrequest.js:963:12)
19 silly fetchPackageMetaData  error for ang2 { [Error: Registry returned 404 for GET on https://registry.npmjs.org/ang2] pkgid: 'ang2', statusCode: 404, code: 'E404' }
20 verbose stack Error: Registry returned 404 for GET on https://registry.npmjs.org/ang2
20 verbose stack     at makeError (C:UsersManmeetAppDataRoamingnpmnode_modulesnpmnode_modulesnpm-registry-clientlibrequest.js:264:12)
20 verbose stack     at CachingRegistryClient.<anonymous> (C:UsersManmeetAppDataRoamingnpmnode_modulesnpmnode_modulesnpm-registry-clientlibrequest.js:242:14)
20 verbose stack     at Request._callback (C:UsersManmeetAppDataRoamingnpmnode_modulesnpmnode_modulesnpm-registry-clientlibrequest.js:172:14)
20 verbose stack     at Request.self.callback (C:UsersManmeetAppDataRoamingnpmnode_modulesnpmnode_modulesrequestrequest.js:199:22)
20 verbose stack     at emitTwo (events.js:100:13)
20 verbose stack     at Request.emit (events.js:185:7)
20 verbose stack     at Request.<anonymous> (C:UsersManmeetAppDataRoamingnpmnode_modulesnpmnode_modulesrequestrequest.js:1036:10)
20 verbose stack     at emitOne (events.js:95:20)
20 verbose stack     at Request.emit (events.js:182:7)
20 verbose stack     at IncomingMessage.<anonymous> (C:UsersManmeetAppDataRoamingnpmnode_modulesnpmnode_modulesrequestrequest.js:963:12)

Edit 2: Changing the import statement to import {AppComponent} from './app.'; fixes the problem.

Why does this fix it ?

Leave a Reply

avatar
  Subscribe  
Notify of