Thanh Nguyen
Thanh Nguyen

Reputation: 5352

Angular 2 import node module error: Cannot find module

I'm trying to use this node module: aws-api-gateway-client

Installation is successful but I cannot use this module because of importing module error.

I don't understand why it works in any projects without angular2 and typescript (I'm using angular-cli tool for my starter project).

import apigClientFactory from 'aws-api-gateway-client'

I also tried with:

import * as apigClientFactory from 'aws-api-gateway-client'

but It doesn't work, this is the error showed in console:

Cannot find module 'aws-api-gateway-client'.

Can anyone help me with this problem?

Upvotes: 1

Views: 4707

Answers (2)

micronyks
micronyks

Reputation: 55453

after installing this package through npm,make sure you grab specific module from system.config.js for further use as follow,

map: {

    'app': './src',
    ....
    ....

    'aws-api-gateway-client': 'node_modules(or npm)/folder Name Which Contains apigClient.js file/apigClient.js ',
    //<---I don't know exact path as I don't use apigCliet in my project 
    //<---but open your node_modules folder and check for apigClient.js path. 

  },

Then,

 import apigClientFactory from 'aws-api-gateway-client'

Upvotes: 1

Sudheer KB
Sudheer KB

Reputation: 1606

Use it as below code

var apigClientFactory = require('aws-api-gateway-client');

Upvotes: 2

Related Questions