Tag: referenceerror

jsPDF ReferenceError:窗口没有定义

我需要在Javascript中创buildPDF。 我find了npm包“jsPDF”。 我用npm install jspdf安装了“jsPDF”。 它成功安装,但是当我执行fowolling代码: const jspdf = require ('jspdf'); let doc = new jspdf(); doc.setFontSize(40); doc.text(35, 25, 'PDF with jsPDF!'); 我得到一个错误,说ReferenceError: window is not defined 。 有没有人知道我的代码有什么问题,或者如果有一些import缺失?

在Javascript类中调用另一个方法

在Javascript中定义一个类时,如何从另一个方法调用一个方法? exports.myClass = function () { this.init = function() { myInternalMethod(); } this.myInternalMethod = function() { //Do something } } 上面的代码在执行时给了我下面的错误: ReferenceError:myInternalMethod未定义 我也试过this.myInternalMethod和self.myInternalMethod,但都导致错误。 什么是正确的方法来做到这一点?

在Node.js中使用JQuery“ReferenceError:$未定义”

我正在尝试在Node.js中使用此框架https://github.com/Schmoopiie/twitch-irc为Twitch构build一个简单的IRC bot,它可以连接到API并检查某些内容,在此参考中,我将检查追随者在bot的当前渠道位于。除了我遇到了一个错误,我不断得到这个错误logging下面。 [31mcrash[39m: ReferenceError: $ is not defined at client.<anonymous> (C:\Users\Exuviax\Desktop\node.js\bot.js:157:9) at client.emit (events.js:117:20) at C:\Users\Exuviax\Desktop\node.js\node_modules\twitch-irc\library\client.js:657:30 at Object.createChannelUserData (C:\Users\Exuviax\Desktop\node.js\node_modules\twitch-irc\library\data.js:56:2) at client._handleMessage (C:\Users\Exuviax\Desktop\node.js\node_modules\twitch-irc\library\client.js:651:22) at Stream.emit (events.js:95:17) at drain (C:\Users\Exuviax\Desktop\node.js\node_modules\twitch-irc\node_modules\irc-message-stream\node_modules\through\index.js:36:16) at Stream.stream.queue.stream.push (C:\Users\Exuviax\Desktop\node.js\node_modules\twitch-irc\node_modules\irc-message-stream\node_modules\through\index.js:45:5) at LineStream.<anonymous> (C:\Users\Exuviax\Desktop\node.js\node_modules\twitch-irc\node_modules\irc-message-stream\index.js:22:16) at LineStream.emit (events.js:95:17) 这是我用来运行的代码,以检查API var irc = require('twitch-irc'); var colors = require('colors'); var jQuery = require('jQuery') var jsdom = require("jsdom"); var […]