You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows11下64位PowerShell无法运行Node.js的问题求助

解决Windows 11下64位PowerShell无法运行Node.js的问题

问题描述

Windows 11用户同时安装了32位和64位Node.js,32位PowerShell能正常运行Node.js,但64位PowerShell不行。已尝试添加环境变量无效,排查发现64位PowerShell使用的源目录不正确。

当前环境变量Path内容:

C:\Program Files\Microsoft MPI\Bin\
C:\Program Files\Common Files\Oracle\Java\javapath
C:\Program Files\Eclipse Adoptium\jdk-17.0.8.101-hotspot\bin
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
C:\Program Files (x86)\Microsoft SQL Server\160\DTS\Binn\
C:\Program Files\Azure Data Studio\bin
C:\tools
C:\ProgramData\chocolatey\bin
C:\Users\USER\AppData\Roaming\nvm
C:\Program Files\nodejs
C:\Program Files\nodejs
C:\Program Files (x86)\nodejs\
C:\Program Files\Git\cmd
C:\Users\USER\AppData\Local\Programs\Python\Launcher\
C:\Users\USER\AppData\Local\Microsoft\WindowsApps
C:\Program Files\Azure Data Studio\bin
C:\Users\USER\AppData\Local\Programs\Python\Python312
C:\Users\USER\AppData\Local\Programs\Python\Python312\Scripts
C:\tools
C:\Users\USER\AppData\Roaming\nvm
C:\Program Files\nodejs
C:\Users\USER\AppData\Local\Programs\Microsoft VS Code\bin
C:\Users\USER\AppData\Roaming\npm
C:\Users\USER\AppData\Local\Microsoft\WinGet\Packages\Typst.Typst_Microsoft.Winget.Source_8wekyb3d8bbwe\typst-x86_64-pc-windows-msvc
C:\Users\USER\AppData\Local\GitHubDesktop\bin

解决方案

1. 调整环境变量Path的顺序与条目

  • 按Win+R输入sysdm.cpl回车,打开系统属性窗口,切换到「高级」标签,点击「环境变量」。
  • 在「系统变量」区域找到Path,点击「编辑」。
  • 删除重复的C:\Program Files\nodejs条目,你的Path里重复出现了三次,留一个即可。
  • 将C:\Program Files\nodejs(64位Node.js路径)移动到C:\Program Files (x86)\nodejs\的前面——系统会按Path的顺序查找可执行文件,把64位路径放前面,64位PowerShell会优先找到64位的Node.js。
  • 点击「确定」保存所有设置。

2. 验证64位PowerShell环境

  • 打开64位PowerShell,输入[Environment]::Is64BitProcess,返回True确认是64位环境。
  • 输入Get-Command node,查看返回的路径是否为C:\Program Files\nodejs\node.exe,如果是则说明路径已生效。

3. 临时测试(无需重启)

如果不想立刻重启系统,可在64位PowerShell中临时修改Path:

$env:Path = "C:\Program Files\nodejs;" + $env:Path

执行后输入node -v,若能正常显示版本,说明调整Path顺序的方案有效,重启PowerShell后永久生效。

4. 重启64位PowerShell

修改环境变量后必须重启64位PowerShell,新的Path配置才会加载。

内容的提问来源于stack exchange,提问作者Dr. direspect

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 13:45:15