Process.getuid () does not work on Windows

I created a script containing only one line of code:

console.log('userid: ' + process.getuid()); 

When I run the script using the node filename.js command, the following error occurs:

 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) 

I am running node.js on Windows.

+6
source share
2 answers

An old question that I know, but thought that I would remove this while someone else is not looking.

Just checking the documents , it would seem that:

Note. This feature is available only on POSIX platforms (i.e. not Windows)

Greetings

John

+8
source

Since I had problems updating npm@2.12.0 , here are the commands that let me solve the problem:

 npm uninstall -g npm npm install -g npm@2.12.1 

To check your version:

 npm -v 

It should be 2.12.1. After that, I could run my install and update commands normally.

Source: see Idez comment on github.

+1
source

Source: https://habr.com/ru/post/914372/


All Articles