Node.js 错误TS2307:找不到模块';蓝鸟';
我目前正在尝试开发一款应用程序,使用离子2和角度2以及类型脚本版本。我决定使用库amqp ts在我的应用程序中包含消息。我通过npm安装了库,如:Node.js 错误TS2307:找不到模块';蓝鸟';,node.js,import,typescript,angular,Node.js,Import,Typescript,Angular,我目前正在尝试开发一款应用程序,使用离子2和角度2以及类型脚本版本。我决定使用库amqp ts在我的应用程序中包含消息。我通过npm安装了库,如: npm install amqp-ts 一切都很顺利,现在我有了这样的东西: / app root directory + node_modules - amqp-ts - lib - amqp-ts.d.ts - node_modules - amqpl
npm install amqp-ts
一切都很顺利,现在我有了这样的东西:
/ app root directory
+ node_modules
- amqp-ts
- lib
- amqp-ts.d.ts
- node_modules
- amqplib
- bluebird
- winston
现在问题开始了:我将库导入到我的组件中,就像在
。。。当我尝试部署应用程序时,会收到下一条错误消息:
TypeScript error: C:/APPs/Test/Ionic2Angular2App/node_modules/amqp-ts/lib/amqp-ts.d.ts(2,26): Error TS2307: Cannot find module 'bluebird'.
TypeScript error: C:/APPs/Test/Ionic2Angular2App/node_modules/amqp-ts/lib/amqp-ts.d.ts(50,12): Error TS2304: Cannot find name 'Buffer'.
1。与第一条错误消息相关的行
// exported Typescript type definition for AmqpSimple
import * as Promise from "bluebird";
[...]
2。与第二条错误消息相关的行(同一文件:amqp-ts.d.ts)
我希望你能帮助我 除常规软件包安装外,您还需要安装打字脚本。键入类似于头文件,它们包含所有方法/类/接口定义 要安装打字,您需要一个打字工具。最好的方法是在全球范围内安装它,这样您就可以在每个项目中使用它
npm install typings --global
然后在项目中安装新的打字非常简单,首先搜索库:
typings search bluebird
安装它:
typings install --save bluebird
更多信息:您为该库安装了打字机吗?非常感谢,它解决了第一条错误消息。我还有第二个(“找不到名称缓冲区”),你知道吗?同样的东西,你需要知道哪个库提供缓冲区打字。缓冲区是NodeJS内部的东西,所以最好的方法是安装NodeJS typings
typings install--save node
无论如何,我看到这个ampq lib stil使用TSD(),检查TSD文档中的打字/迁移,它应该可以帮助您解决未来的问题(可能下一个错误将丢失winston
和打字时)。我不确定如何处理打字
,因为我也绑定到TSD,但例如尝试引用节点模块/ampq ts/libs/typings/TSD.d.ts
文件(
)
typings search bluebird
typings install --save bluebird