I'm using Angular 2 with angular-cli and I installed the elasticsearch library with
nom install --save elasticsearch
There is an elasticsearch directory in node_modules.
I do the import with
import * as elasticsearch from 'elasticsearch';
As I understand this is a relative path that will resolve to the node_modules path and angular-cli (with ng serve) will take care of bundling everything properly.
However I get the following error:
ERROR in [default] /Users/xxx/yyy/src/app/shared/elasticsearch/es.service.ts:4:31
Cannot find module 'elasticsearch'.
Any help would be appreciated.
I confirmed that the problem appears with an empty project generated with ng init.
Also, doing something like this:
var elasticsearch = require('elasticsearch');
works well.