VSCode中编译含有cheerio的一个小爬虫报错,为什么找不到Document?

VSCode中编译含有cheerio的一个TypeScript语言编写的小爬虫,报错。

其中使用了npm插件cheerio。

编译报错如下:

> tsc -p ./src
node_modules/.0.17.31@@types/cheerio/index.d.ts(120,36): error TS2304: Cannot find name 'Document'.
node_modules/.0.17.31@@types/cheerio/index.d.ts(131,21): error TS2304: Cannot find name 'Document'.
node_modules/.0.17.31@@types/cheerio/index.d.ts(132,21): error TS2304: Cannot find name 'Document'.
node_modules/.0.17.31@@types/cheerio/index.d.ts(136,22): error TS2304: Cannot find name 'Document'.
node_modules/.0.17.31@@types/cheerio/index.d.ts(137,22): error TS2304: Cannot find name 'Document'.
node_modules/.0.17.31@@types/cheerio/index.d.ts(141,20): error TS2304: Cannot find name 'Document'.
node_modules/.0.17.31@@types/cheerio/index.d.ts(142,20): error TS2304: Cannot find name 'Document'.
node_modules/.0.17.31@@types/cheerio/index.d.ts(146,26): error TS2304: Cannot find name 'Document'.
node_modules/.0.17.31@@types/cheerio/index.d.ts(150,21): error TS2304: Cannot find name 'Document'.
node_modules/.0.17.31@@types/cheerio/index.d.ts(151,21): error TS2304: Cannot find name 'Document'.
node_modules/.0.17.31@@types/cheerio/index.d.ts(155,27): error TS2304: Cannot find name 'Document'.
node_modules/.0.17.31@@types/cheerio/index.d.ts(233,39): error TS2304: Cannot find name 'Document'.
node_modules/.0.17.31@@types/cheerio/index.d.ts(233,73): error TS2304: Cannot find name 'Document'.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\sunru\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "compile"
npm ERR! node v5.6.0
npm ERR! npm  v3.8.9
npm ERR! code ELIFECYCLE
npm ERR! ts-sexy-craw@0.0.0 compile: `tsc -p ./src`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the ts-sexy-craw@0.0.0 compile script 'tsc -p ./src'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ts-sexy-craw package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc -p ./src
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ts-sexy-craw
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ts-sexy-craw
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     e:\GitCode\xxxx\npm-debug.log

百思不得其解

阅读 3.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题