NPM 模块 system-sleep 永远休眠
NPM module system-sleep sleeps forever
我的代码很简单。但是只打印了 0。 sleep sleep forever :( 我没有注意到什么错误???
import sleep from 'system-sleep';
function starti()
{
for (var y = 0; y < 10; y++) {
console.log(y);
sleep(1000);
}
}
starti()
我认为问题出在“system-sleep”库中,这可能有两个原因:
你正在使用它作为 es-module,我已经尝试了两种类型(common-js en es-module)和 common-js 类型都可以正常工作(var sleep = require('system-sleep')
)
您正在使用节点 >= 14,这似乎 broke the library :(
既然你没有做错,我建议你换库
我的代码很简单。但是只打印了 0。 sleep sleep forever :( 我没有注意到什么错误???
import sleep from 'system-sleep';
function starti()
{
for (var y = 0; y < 10; y++) {
console.log(y);
sleep(1000);
}
}
starti()
我认为问题出在“system-sleep”库中,这可能有两个原因:
你正在使用它作为 es-module,我已经尝试了两种类型(common-js en es-module)和 common-js 类型都可以正常工作(
var sleep = require('system-sleep')
)您正在使用节点 >= 14,这似乎 broke the library :(
既然你没有做错,我建议你换库