ng2-typeahead icon indicating copy to clipboard operation
ng2-typeahead copied to clipboard

Error: Can't find module "ng2-typeahead'.

Open Fresh-Dev-zunairzakir opened this issue 8 years ago • 5 comments

Hi All,

An issue regarding adding "ng2-typeahead' module. I have added "ng2-typeahead' through npm and its properly added in my node_modules folder but

when I do : import { Typeahead } from 'ng2-typeahead'; Error: Can't find module "ng2-typeahead'.

It's only working when I do:

import { Typeahead } from '../../../node_modules/ng2-typeahead/src/ng2-typeahead';

Can any body guide me why I need to give path from node_modules ?

Fresh-Dev-zunairzakir avatar Oct 04 '16 12:10 Fresh-Dev-zunairzakir

I have the same problem.

cederlof avatar Oct 18 '16 11:10 cederlof

Facing the same issue.

skgyan avatar Nov 16 '16 05:11 skgyan

I've got the same probleam. Any solution?

BCaldas avatar Nov 16 '16 15:11 BCaldas

My coworker has solved the probleam. You need create a Typescript file (.ts) named index.ts inside the \node_modules\ng2-typeahead directory and put this content inside:

export * from './src/ng2-typeahead';

it works to us. I hope it can help you!

BCaldas avatar Nov 16 '16 17:11 BCaldas

Adding a new file in node_modules is not the recommended way. You can also simply import the module like this: import { Typeahead } from 'ng2-typeahead/src/ng2-typeahead';

julienboulay avatar Nov 18 '16 10:11 julienboulay