I try to use the Elasticsearch NPM Module in my Angular2 App.
I import it within my service using:
import { Client, SearchResponse } from 'elasticsearch';
Typescript Compiler does not complain, but ng serve
outputs:
Cannot find module 'elasticsearch'
Same happens if I try to use:
import { Client, SearchResponse } from '../../node_modules/elasticsearch/webpack_config/angular.js';
install the typings for it :
npm i @types/[email protected]
Also , have a look at your tsconfig.json and make sure it's in there as well :
Older version of typescript :
"types": [
"elasticsearch"
]
New version of typescript ( >2)
"typeRoots": [
"node_modules/@types"
]
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments