vscode中执行npm run dev报错web-streams-polyfill、dommatrix

问题描述

出现如下问题

 [ERROR] Could not resolve "dommatrix/dist/dommatrix.js"

    node_modules/pdfh5/js/pdf.js:22:23008:
      22...&&(globalThis.DOMMatrix=require("dommatrix/dist/dommatrix.js"))}();!function checkReadableSt...
         ╵                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "dommatrix/dist/dommatrix.js" as external to exclude it from the bundle,
  which will remove this error and leave the unresolved path in the bundle. You can also surround
  this "require" call with a try/catch block to handle this failure at run-time instead of
  bundle-time.

X [ERROR] Could not resolve "web-streams-polyfill/dist/ponyfill.js"

    node_modules/pdfh5/js/pdf.js:22:23150:
      22...his.ReadableStream=require("web-streams-polyfill/dist/ponyfill.js").ReadableStream)}();!func... 
         ╵                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "web-streams-polyfill/dist/ponyfill.js" as external to exclude it from the
  bundle, which will remove this error and leave the unresolved path in the bundle. You can also
  surround this "require" call with a try/catch block to handle this failure at run-time instead of
  bundle-time.

一共两种问题:

[ERROR] Could not resolve "web-streams-polyfill/dist/ponyfill.js"
[ERROR] Could not resolve "dommatrix/dist/dommatrix.js"

问题解决

第一步先执行:

 npm install  canvas@2.8.0 --ignore-scripts

只执行npm install canvas会报新的错误

第二步执行:

npm install --save dommatrix

第三步执行:

npm install --save web-streams-polyfill

参考npm报错:These dependencies were not found:* canvas in ./node_modules/pdfh5/js/pdf.js* dommatrix/dist/d

  • 6
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值