Nodejs, Find 32 or 64 bit in windows/Linux

Sometimes, We need to know whether NodeJS is installed on 32 bit or 64 bit machine of a Current windows, Linux,mac and ubuntu. 32 bit is 4 bytes of data, 64 bit is 8 bytes of data memory allocated, so Each machine has different architecture to store and process the data.

Nodejs offers multiple ways to know it

  • using REPL
  • Javascript programming

Check 32 bit or 64 bit using REPL

REPL is an console for NODEJS to execute commands, It is like windows command prompt or Linux shell prompt. This comes with default installation of Nodejs platform

First way, To get into REPL mode, Type node in command prompt, You will get REPL mode in interactive mode.

Nodejs provides OS module, to get current installed machine information. arch() function returns current system CPU information, return values are x32, x64

> require('os').arch()

Second way, using process global object , get the current node process information. it is not required to import module as it is global object.


And it outputs lot of process meta data environment information. One of the property is PROCESSOR_ARCHITECTURE and it’s value tells about 64bit or not.

Platform: 'MCD',
platformcode: 'KV',
PROCESSOR_IDENTIFIER: 'Intel64 Family 6 Model 78 Stepping 3, GenuineIntel',

or Third way, process.arch gives Nodejs process global objects arch gives

node -p "process.arch"

This returns ia32 for 32 machine, or x64 for 64bit machines

Find 32 bit or 64 bit using JavaScript

First, using OS inbuilt module, import it using require keyword using arch() method return process architecture

const os = require('os'); 

Second way is using process global object with arch property


Finally, using process.env returns process meta information

console.log(process.env.PROCESSOR_ARCHITECTURE) //returns AMD64 or IA32


Nodejs offers many ways to know about process current machine information either REPL command or Java script code.

I hope you liked :-)

Join 90,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.

Similar Posts