我找不到我的问题!
/var/www/html/bot# nodejs driver
/var/www/html/bot/driver.js:2239
});
^
SyntaxError: Unexpected token }
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
如果我在2239行上走,那什么也没有!我之前在1631行遇到了这个问题,我尝试修复,现在在2239行
请帮帮我!
编辑:
最后几行
function time() {
return parseInt(new Date().getTime()/1000)
}
function generate(count) {
return crypto.randomBytes(count).toString('hex');
}
function array_limit(wartosc){
if(chat_history.length==25){
chat_history.shift();
chat_history.shift();
}
chat_history.push(wartosc);
}
function jp_limit(wartosc){
if(jpWinners.length==10){
jpWinners.shift();
}
jpWinners.push(wartosc);
}
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
我在最后几行中看不到问题...
答案 0 :(得分:0)
答案就在您眼前:
/var/www/html/bot/driver.js:2239
});
^
SyntaxError: Unexpected token }
您是否在第二行的右大括号下方看到该符号?
这是错误发生位置的直观指示。
此外,在第3行上,您会看到错误消息本身-“意外令牌”-然后是意外令牌本身-“}”。
您最有可能做的是添加了一个额外的右花括号,或者您没有首先添加左花括号。
一个好的方法通常是在定义一个新对象时一开始键入两个大括号,然后向左移动一个空格,按Enter键,瞧-您有一个空对象,带有适当数量的大括号。现在,您只需要用所需的属性填充它即可。