Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 2导入节点模块错误:找不到模块_Angular_Typescript - Fatal编程技术网

Angular 2导入节点模块错误:找不到模块

Angular 2导入节点模块错误:找不到模块,angular,typescript,Angular,Typescript,我正在尝试使用此节点模块: 安装成功,但由于导入模块错误,我无法使用此模块 我不明白为什么它在没有angular2和typescript的项目中工作(我正在为我的初学者项目使用这个工具) 我还尝试了: import * as apigClientFactory from 'aws-api-gateway-client' 但它不工作,这是控制台中显示的错误: Cannot find module 'aws-api-gateway-client'. 有人能帮我解决这个问题吗?按照下面的代码使用它

我正在尝试使用此节点模块:

安装成功,但由于导入模块错误,我无法使用此模块

我不明白为什么它在没有angular2和typescript的项目中工作(我正在为我的初学者项目使用这个工具)

我还尝试了:

import * as apigClientFactory from 'aws-api-gateway-client'
但它不工作,这是控制台中显示的错误:

Cannot find module 'aws-api-gateway-client'.
有人能帮我解决这个问题吗?

按照下面的代码使用它

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

通过npm安装此软件包后,请确保从
system.config.js
中获取特定模块,以便进一步使用,如下所示:

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. 

  },

您是否在system.config中定义了它?问题不是很清楚。安装lib时是否遇到问题?您是否使用npm install安装了lib?@echonax您能告诉我如何在system.config中定义它吗?@Divs安装成功,但由于我在帖子中提到的错误,我无法在我的项目中使用它。@NguyenThanh您能在您的问题中提供它吗?
模块未找到:错误:无法解析“aws api网关客户端”
它工作正常对我来说,我使用的是网页包。你是否成功安装了aws api网关客户端?是的,它与webpack配合使用效果很好,但我不知道为什么它与angular2+typescript项目不配合。我不知道为什么你的解决方案在我尝试谷歌搜索数小时后突然起作用。在中找不到system.config.jsangular4@Yasar阿拉法特在那里。您可以在src/app文件夹中查看它。
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. 

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