无法识别术语“节点"...在 Powershell 中 [英] The term 'node' is not recognized... In Powershell

查看:75
本文介绍了无法识别术语“节点"...在 Powershell 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一整天都在努力解决这个问题.

I have been trying to resolve this issue for the whole day.

当我在 cmd 提示符下运行 node -vnpm install 时,它工作得非常好.但是当我在 Powershell 中运行相同的命令时,它给出了以下错误:s

When I run node -v or npm install in cmd prompt, it works absolutely fine. But when I run the same commands in Powershell, it gives the following error:s

PS C:\Users\Anubhav.Trivedi> node -v
The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelli
ng of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:5
+ node <<<<  -v
    + CategoryInfo          : ObjectNotFound: (node:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我尝试卸载 node js 并重新安装它.将 node js 路径 C:\Program Files (x86)\nodejs\ 添加到环境变量(系统变量).重新启动计算机.但似乎没有任何效果.请让我知道,我在这里遗漏了什么.

I tried uninstalling node js and reinstalling it. Added node js path C:\Program Files (x86)\nodejs\ to enviroment variables (system variables). Restarting computer. But nothing seems to work. Kindly let me know, what am I missing here.

推荐答案

正如 dan-gph 提到的,使用脚本 $env:path -split ';' 检查环境变量中的 Path|Select-String nodejs 并在环境变量中更新 Path 后,确保重新启动 powershell 并重新启动 explorer.exe.这将解决问题.

As dan-gph mentioned check the Path in environment variable using script $env:path -split ';' | Select-String nodejs and once you update the Path in environment variable, make sure to restart powershell and also restart explorer.exe. This would resolve the issue.

如果您仍然遇到问题,请检查您安装了哪个 nodejs(32 位或 64 位).仅安装 32 位,因为 powershell 或 cmd 是 32 位程序

If you still face issues, check which nodejs you have installed (32bit or 64bit). Install 32 bit only as powershell or cmd are 32bit programs

这篇关于无法识别术语“节点"...在 Powershell 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆