如何确定是否安装了64位或32位节点?

时间:2022-07-18 07:23:43

On my windows pc I have nodejs installed. I would like to determine whether it is 64 bit or 32 bit. How can one determine that? I executed

我在windows电脑上安装了nodejs。我想确定它是64位还是32位。怎么才能确定呢?我执行

node --help

but that does not seem to have any option to give me the desired information.

但那似乎没有任何选项可以给我想要的信息。

7 个解决方案

#1


49  

If node is installed and executable you can simply run

如果已经安装了node并可执行,您可以简单地运行它

c:\> node -p "process"    

and you should see the content of the process variable formatted. There the keys arch and platform indicates your operating system. In the example below it's an Windows 7 x64

您应该看到格式化了的流程变量的内容。在那里,键拱和平台指示您的操作系统。在下面的示例中,它是一个Windows 7 x64。

{
    title : 'Administrator: C:\\Windows\\System32\\cmd.exe - node  ',
    version : 'v0.10.36',
    moduleLoadList :
    [   'Binding evals',
        ...
        'Binding signal_wrap',
        'NativeModule string_decoder'],
    versions : {
        http_parser : '1.0',
        node : '0.10.36',
        v8 : '3.14.5.9',
        ares : '1.9.0-DEV',
        uv : '0.10.30',
        zlib : '1.2.8',
        modules : '11',
        openssl : '1.0.1l'
    },
    arch : 'x64',
    platform : 'win32',
    argv : ['node'],
    execArgv : [],
    env : {
        ALLUSERSPROFILE : 'C:\\ProgramData',
        HOMEDRIVE : 'C:',
        JAVA_HOME : 'C:\\Program Files\\Java\\jdk1.8.0_05',
        NODEJS : 'C:\\Program Files (x86)\\nodejs\\',
        NUMBER_OF_PROCESSORS : '4',
        OS : 'Windows_NT',
        Path : 'C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;',
        PATHEXT : '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY',
        PROCESSOR_ARCHITECTURE : 'AMD64',
        PROCESSOR_IDENTIFIER : 'Intel64 Family 6 Model 42 Stepping 7, GenuineIntel',
        PROCESSOR_LEVEL : '6',
        PROCESSOR_REVISION : '2a07',
        ProgramData : 'C:\\ProgramData',
        ProgramFiles : 'C:\\Program Files', 
        'ProgramFiles(x86)' : 'C:\\Program Files (x86)',
        ProgramW6432 : 'C:\\Program Files',
        PROMPT : '$P$G',
        PUBLIC : 'C:\\Users\\Public',
        PYTHON : 'C:\\Python34',
        SESSIONNAME : 'Console',
        SystemDrive : 'C:',
        SystemRoot : 'C:\\Windows',
        windir : 'C:\\Windows',
        windows_tracing_flags : '3'
    },
    features : {
        ...
    },
    config : {
        ...
    }
}

#2


48  

Run this from the command line:

从命令行运行这个:

node -p "process.arch"

It will return 'arm', 'ia32', or 'x64'.

它将返回“arm”、“ia32”或“x64”。

#3


25  

If it's on Windows OS, just go an old-school way.. by using Windows Task Manager.

如果是在Windows操作系统上,那就走老路吧。通过使用Windows任务管理器。

Here is my attempt:-

这是我的尝试:-

Simply run node from command prompt.

只需从命令提示符运行节点。

C:\> node

C:\ >节点

This will put node into REPL mode (indicated by > symbol). Now open Task Manager (Ctrl+Shift+Esc) to see node.exe process details. Mine is on Windows 10 64-bit with node 32-bit installed. Make sure you enable 'Platform' column to see 32-bit/64-bit information.

这将把节点放入REPL模式(由>符号表示)。现在打开任务管理器(Ctrl+Shift+Esc)查看node。exe流程细节。我的是在Windows 10 64位上安装的节点32位。确保启用“平台”列来查看32位/64位信息。

如何确定是否安装了64位或32位节点?

#4


19  

in mac

在mac

$ node
 > require('os').arch()

in windows

在windows中

c:\> node
> require('os').arch()

#5


4  

Well the way I am suggesting is not at all a good way . You can go over to C: then go to Program Files and search nodejs folder there . If it is found then you are running 64 bit version else check on Program Files (x86) . If it is found there then you are running 32 bit version.

我说的方法一点也不好。您可以转到C:然后转到程序文件并在那里搜索nodejs文件夹。如果找到它,那么您将运行64位版本的其他检查程序文件(x86)。如果它被发现,那么您正在运行32位版本。

#6


1  

This likely doesn't directly solve your problem, as I don't know the best way to get the same behavior on Windows, but using the file command on a Unix or Linux system will tell you the processor architecture of an executable:

这可能不能直接解决您的问题,因为我不知道在Windows上获得相同行为的最佳方式,但是在Unix或Linux系统上使用file命令将告诉您可执行文件的处理器体系结构:

$ file `which node`
/usr/local/bin/node: Mach-O 64-bit executable x86_64

If you have Cygwin installed, I'm pretty sure that it provides a file command, or else you could check online for similar programs that work on Windows.

如果您已经安装了Cygwin,我很确定它提供了一个文件命令,或者您可以在网上查看Windows上的类似程序。

#7


0  

Just start node interpreter by running node. then in that, process.env gives a json with all the information you require. My try has a PROCESSOR_ARCHITECTURE: 'AMD64' entry in that.

只需通过运行节点启动节点解释器。然后,过程。env向json提供了所需的所有信息。我的尝试有一个PROCESSOR_ARCHITECTURE: 'AMD64'条目。

I also find

我也发现

ProgramFiles: 'C:\\Program Files', 'ProgramFiles(x86)': 'C:\\Program Files (x86)' ProgramW6432: 'C:\\Program Files'

程序文件:“C:\\程序文件”,“程序文件(x86)”:“C:\\程序文件(x86)”程序w6432:“C:\\程序文件”

#1


49  

If node is installed and executable you can simply run

如果已经安装了node并可执行,您可以简单地运行它

c:\> node -p "process"    

and you should see the content of the process variable formatted. There the keys arch and platform indicates your operating system. In the example below it's an Windows 7 x64

您应该看到格式化了的流程变量的内容。在那里,键拱和平台指示您的操作系统。在下面的示例中,它是一个Windows 7 x64。

{
    title : 'Administrator: C:\\Windows\\System32\\cmd.exe - node  ',
    version : 'v0.10.36',
    moduleLoadList :
    [   'Binding evals',
        ...
        'Binding signal_wrap',
        'NativeModule string_decoder'],
    versions : {
        http_parser : '1.0',
        node : '0.10.36',
        v8 : '3.14.5.9',
        ares : '1.9.0-DEV',
        uv : '0.10.30',
        zlib : '1.2.8',
        modules : '11',
        openssl : '1.0.1l'
    },
    arch : 'x64',
    platform : 'win32',
    argv : ['node'],
    execArgv : [],
    env : {
        ALLUSERSPROFILE : 'C:\\ProgramData',
        HOMEDRIVE : 'C:',
        JAVA_HOME : 'C:\\Program Files\\Java\\jdk1.8.0_05',
        NODEJS : 'C:\\Program Files (x86)\\nodejs\\',
        NUMBER_OF_PROCESSORS : '4',
        OS : 'Windows_NT',
        Path : 'C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;',
        PATHEXT : '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY',
        PROCESSOR_ARCHITECTURE : 'AMD64',
        PROCESSOR_IDENTIFIER : 'Intel64 Family 6 Model 42 Stepping 7, GenuineIntel',
        PROCESSOR_LEVEL : '6',
        PROCESSOR_REVISION : '2a07',
        ProgramData : 'C:\\ProgramData',
        ProgramFiles : 'C:\\Program Files', 
        'ProgramFiles(x86)' : 'C:\\Program Files (x86)',
        ProgramW6432 : 'C:\\Program Files',
        PROMPT : '$P$G',
        PUBLIC : 'C:\\Users\\Public',
        PYTHON : 'C:\\Python34',
        SESSIONNAME : 'Console',
        SystemDrive : 'C:',
        SystemRoot : 'C:\\Windows',
        windir : 'C:\\Windows',
        windows_tracing_flags : '3'
    },
    features : {
        ...
    },
    config : {
        ...
    }
}

#2


48  

Run this from the command line:

从命令行运行这个:

node -p "process.arch"

It will return 'arm', 'ia32', or 'x64'.

它将返回“arm”、“ia32”或“x64”。

#3


25  

If it's on Windows OS, just go an old-school way.. by using Windows Task Manager.

如果是在Windows操作系统上,那就走老路吧。通过使用Windows任务管理器。

Here is my attempt:-

这是我的尝试:-

Simply run node from command prompt.

只需从命令提示符运行节点。

C:\> node

C:\ >节点

This will put node into REPL mode (indicated by > symbol). Now open Task Manager (Ctrl+Shift+Esc) to see node.exe process details. Mine is on Windows 10 64-bit with node 32-bit installed. Make sure you enable 'Platform' column to see 32-bit/64-bit information.

这将把节点放入REPL模式(由>符号表示)。现在打开任务管理器(Ctrl+Shift+Esc)查看node。exe流程细节。我的是在Windows 10 64位上安装的节点32位。确保启用“平台”列来查看32位/64位信息。

如何确定是否安装了64位或32位节点?

#4


19  

in mac

在mac

$ node
 > require('os').arch()

in windows

在windows中

c:\> node
> require('os').arch()

#5


4  

Well the way I am suggesting is not at all a good way . You can go over to C: then go to Program Files and search nodejs folder there . If it is found then you are running 64 bit version else check on Program Files (x86) . If it is found there then you are running 32 bit version.

我说的方法一点也不好。您可以转到C:然后转到程序文件并在那里搜索nodejs文件夹。如果找到它,那么您将运行64位版本的其他检查程序文件(x86)。如果它被发现,那么您正在运行32位版本。

#6


1  

This likely doesn't directly solve your problem, as I don't know the best way to get the same behavior on Windows, but using the file command on a Unix or Linux system will tell you the processor architecture of an executable:

这可能不能直接解决您的问题,因为我不知道在Windows上获得相同行为的最佳方式,但是在Unix或Linux系统上使用file命令将告诉您可执行文件的处理器体系结构:

$ file `which node`
/usr/local/bin/node: Mach-O 64-bit executable x86_64

If you have Cygwin installed, I'm pretty sure that it provides a file command, or else you could check online for similar programs that work on Windows.

如果您已经安装了Cygwin,我很确定它提供了一个文件命令,或者您可以在网上查看Windows上的类似程序。

#7


0  

Just start node interpreter by running node. then in that, process.env gives a json with all the information you require. My try has a PROCESSOR_ARCHITECTURE: 'AMD64' entry in that.

只需通过运行节点启动节点解释器。然后,过程。env向json提供了所需的所有信息。我的尝试有一个PROCESSOR_ARCHITECTURE: 'AMD64'条目。

I also find

我也发现

ProgramFiles: 'C:\\Program Files', 'ProgramFiles(x86)': 'C:\\Program Files (x86)' ProgramW6432: 'C:\\Program Files'

程序文件:“C:\\程序文件”,“程序文件(x86)”:“C:\\程序文件(x86)”程序w6432:“C:\\程序文件”