Javascript process.getuid()在Windows上不工作
我创建了一个只包含一行代码的脚本:Javascript process.getuid()在Windows上不工作,javascript,node.js,Javascript,Node.js,我创建了一个只包含一行代码的脚本: console.log('userid: ' + process.getuid()); 当我使用命令node filename.js运行脚本时,出现以下错误: node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ TypeError: Object #<EventEmitter> has no method 'getuid' a
console.log('userid: ' + process.getuid());
当我使用命令node filename.js
运行脚本时,出现以下错误:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object #<EventEmitter> has no method 'getuid'
at Object.<anonymous> (c:\PROGRA~1\nodejs\node_modules\mrt\p.js:1:96)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:40)
node.js:201
抛出e;//process.nextTick错误,或第一次勾选时的“error”事件
^
TypeError:对象#没有方法“getuid”
反对。(c:\PROGRA~1\nodejs\node\u modules\mrt\p.js:1:96)
在模块处编译(Module.js:441:26)
at Object..js(module.js:459:10)
在Module.load(Module.js:348:31)
at功能。加载(module.js:308:12)
at Array.0(module.js:479:10)
在EventEmitter上进行回调(node.js:192:40)
我正在Windows上运行node.js。我知道这个老问题,但我想我会整理一下,以防其他人搜索 只要仔细检查一下,就会发现: 注意:此功能仅在POSIX平台(即非Windows)上可用 干杯
约翰因为我有更新的问题npm@2.12.0,下面是解决此问题的命令:
npm uninstall -g npm
npm install -g npm@2.12.1
要在以后检查您的版本,请执行以下操作:
npm -v
那么应该是2.12.1。之后,我可以正常运行安装/更新命令
来源:请参阅github下的注释。这一行代码本身应该运行良好。您使用的是什么版本?我已经下载了最新版本;v0.6.15I重新检查了所有内容,但存在错误。这是节点中的错误吗?!你在Windows上使用Node.js吗?是的,我在Windows 7上使用Node