简体   繁体   English

body-parser.d.ts中的打字稿编译错误:找不到符号“缓冲区”

[英]typescript compile error in body-parser.d.ts: Could not find symbol 'Buffer'

I am getting the following compile errors in body-parser.d.ts when compiling my typescript file. 编译我的打字稿文件时,在body-parser.d.ts中收到以下编译错误。

error TS2095: Could not find symbol 'Buffer'. 错误TS2095:找不到符号“缓冲区”。 error TS2094: The property 'RequestHandler' does not exist on value of type 'express'. 错误TS2094:类型'express'的值上不存在属性'RequestHandler'。

And I have the following lines in my app.ts file. 我的app.ts文件中包含以下几行。

///<reference path='../Scripts/typings/node/node.d.ts'/>
///<reference path='../Scripts/typings/body-parser/body-parser.d.ts'/>

import express = require('express');
import bodyParser = require('body-parser');
import http = require('http');
import path = require('path');

Why am I getting the errors? 为什么会出现错误?

Make sure you have express.d.ts as it is required for body-parser.d.ts : https://github.com/borisyankov/DefinitelyTyped/blob/master/body-parser/body-parser.d.ts#L6 请确保您有express.d.ts ,因为它需要body-parser.d.tshttps://github.com/borisyankov/DefinitelyTyped/blob/master/body-parser/body-parser.d.ts# L6

Very unlikely to be a bug in the Definitions as DefinitelyTyped is compiled to make sure that such errors don't make it to users like yourself. 由于DefinitelyTyped会被编译以确保此类错误不会对像您这样的用户产生影响,因此不太可能是“定义”中的错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误1找不到符号“ $” - Error 1 Could not find symbol '$' Webstorm Typescript支持-找不到符号? - Webstorm Typescript support - Could not find symbol? 如何编译TypeScript Phaser项目,使其仅使用phaser.d.ts引用路径找到“ Phaser”命名空间? - How can I compile my TypeScript Phaser project such that it will find the “Phaser” namespace using only a phaser.d.ts reference path? Typescript 无法编译类型不存在的错误 TS2339 - Typescript can't compile type not existing Error TS2339 @ types / node / index.d.ts(6208,55):错误TS2304:找不到名称&#39;Map&#39;&#39;设置&#39;&#39;符号&#39;&#39;弱地图&#39;&#39;弱设置&#39; - @types/node/index.d.ts(6208,55): error TS2304: Cannot find name 'Map' 'Set' 'Symbol' 'WeakMap' 'WeakSet' 错误:找不到缓冲区的 MIME<null></null> - Error: Could not find MIME for Buffer <null> 打字稿 - 模块函数引用不同的文件 - “找不到符号” - Typescript - module functions reference in different file - “could not find symbol” 如何停止缺少d.ts文件的编译错误? - How to stop compile error for missing d.ts file? 错误 TS6231:无法使用扩展名解析路径“”:“.ts”、“.tsx”、“.d.ts” - error TS6231: Could not resolve the path '' with the extensions: '.ts', '.tsx', '.d.ts' 尽管存在angular.d.ts文件,TypeScript的VS2015内部版本仍给出“ TS2304:内部找不到角度”错误 - VS2015 build of TypeScript gives “TS2304:Build cannot find angular” error despite presence of angular.d.ts file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM