简体   繁体   English

未捕获的类型错误:_konva.default.stage 不是构造函数

[英]Uncaught TypeError: _konva.default.stage is not a constructor

I'm trying to use KonvaJS and I've chosen to install it via npm.我正在尝试使用 KonvaJS,我选择通过 npm 安装它。 So, as mentioned on https://konvajs.org/docs/index.html I used "npm install konva", everything looked ok.因此,正如https://konvajs.org/docs/index.html中所述,我使用了“npm install konva”,一切看起来都还不错。 I imported Konva in my index.js like that: import Konva from 'konva';我像这样在 index.js 中导入了 Konva: import Konva from 'konva';

And my index.js is related to my index.html with a script tag at the end of the body: <script type="text/javascript" src="./index.js"></script>而且我的 index.js 与我的 index.html 相关,在正文末尾带有一个脚本标记: <script type="text/javascript" src="./index.js"></script>

When I try to parcel index.html, I get an "Uncaught TypeError: _konva.default.stage is not a constructor".当我尝试打包 index.html 时,我收到“未捕获的类型错误:_konva.default.stage 不是构造函数”。

Of course, nothing Konva-related appears on the page, as the error is located at line 5: const stage = new Konva.stage({当然,页面上不会出现任何与 Konva 相关的内容,因为错误位于第 5 行: const stage = new Konva.stage({

I read https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_a_constructor but I really don't see where my mistake is.我读了 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_a_constructor但我真的不明白我的错误在哪里。 (I also saw https://github.com/konvajs/konva/issues/598 but I don't use TypeScript.) (我也看到了https://github.com/konvajs/konva/issues/598但我不使用 TypeScript。)

You need to have Stage with capital S: Konva.Stage您需要拥有大写 S 的 Stage: Konva.Stage

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

相关问题 错误:未捕获 [TypeError:default is not a constructor] jest mock - Error: Uncaught [TypeError:default is not a constructor] jest mock 未捕获的类型错误:_models_Search__WEBPACK_IMPORTED_MODULE_0___default.a 不是构造函数 - Uncaught TypeError: _models_Search__WEBPACK_IMPORTED_MODULE_0___default.a is not a constructor 获取未捕获的TypeError:...默认不是构造函数 - 来自Vue组件 - Getting Uncaught TypeError: …default is not a constructor - from Vue component Konva/Vue-Konva 遇到错误 client.js:227 TypeError: Konva.Layer is not a constructor - Konva/Vue-Konva running into error client.js:227 TypeError: Konva.Layer is not a constructor 木偶:未被捕获的TypeError:*不是构造函数 - Marionette: Uncaught TypeError: * is not a constructor Javascript:未捕获的TypeError,不是构造函数 - Javascript: Uncaught TypeError, not a constructor 未捕获的TypeError:CanvasSpliner不是构造函数 - Uncaught TypeError: CanvasSpliner is not a constructor 未捕获的 TypeError:PouchDB 不是构造函数 - Uncaught TypeError: PouchDB is not a constructor 未捕获的 TypeError:juego 不是构造函数 - Uncaught TypeError: juego is not a constructor 未捕获的类型错误:视口不是构造函数 - Uncaught TypeError: Viewport is not a constructor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM