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

发布于 2022-09-04 10:36:22 字数 2524 浏览 23 评论 0

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

百思不得其解

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文