node-posix setrlimit crashes,EINVAL - 参数无效

aps*_*nce 5 posix node.js

以下的男女同意给了我一个EINVAL错误和Node崩溃:

var posix = require('posix');
console.log(posix.getrlimit('nofile'));
posix.setrlimit('nofile', {soft: 10000});


ERROR:

/var/myfil/index.js:19
posix.setrlimit('nofile', {soft: 10000});
      ^
Error: EINVAL, Invalid argument
    at Object.<anonymous> (/var/myfile/index.js:19:7)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
Run Code Online (Sandbox Code Playgroud)

问题是什么?它与文档完全一样.

Gra*_*Fox 7

如果您尝试设置高于硬限制的软限制,则会发生这种情况.

尝试将它们设置为:

posix.setrlimit('nofile', { soft: 10000, hard: 10000 });
Run Code Online (Sandbox Code Playgroud)