简体   繁体   English

在 Visual Studio 代码中运行“node -v”时出现错误

[英]I get an error running "node -v" in visual studio code

I'm brand new to coding and this is stumping me for some reason.我是编码的新手,这让我很困惑。 The error that comes up when I type node -v in my visual studio code terminal is 'node : The term 'node' is not recognized as the name of a cmdlet... It works just fine when I run it in command prompt on my computer.当我在我的 Visual Studio 代码终端中键入node -v时出现的错误是'node: The term 'node' is not recognized as the name of a cmdlet...当我在命令提示符下运行它时它工作得很好我的电脑。 I've read everywhere that you have to add it to your path which I'm not sure I did correctly now.我到处读到你必须将它添加到你的路径中,我不确定我现在是否正确。 I attached some pictures of what the path looks like for the user and system variable.我附上了一些关于用户和系统变量的路径的图片。 I am hoping someone could give some feedback if this looks right or not.如果这看起来正确与否,我希望有人可以提供一些反馈。 Thanks :)谢谢 :)

user variable用户变量

system variable系统变量

I had this issue when I first got Node.当我第一次获得 Node.js 时,我遇到了这个问题。 The solution is to restart VSCode, opening new terminal sessions inside VSCode won't help for some reason.解决方案是重新启动 VSCode,在 VSCode 中打开新的终端会话由于某种原因无济于事。 You will, of course, have had to add it to PATH which you said you have.当然,您必须将它添加到您所说的 PATH 中。

It wouldn't work in command prompt if you haven't added it to PATH so I think your configuration is correct.如果您尚未将其添加到 PATH 中,它将无法在命令提示符下工作,因此我认为您的配置是正确的。 However, some of your variables are in Appdata/Roaming .但是,您的一些变量位于Appdata/Roaming中。 I think it's supposed to be in ProgramFiles or ProgramFiles x86 , but you can check this by going to the filepath you've put into your environment variables using file explorer, and checking if there's a node.exe or npm.exe file there.我认为它应该在ProgramFilesProgramFiles x86中,但是您可以通过使用文件资源管理器转到您放入环境变量的文件路径并检查那里是否有node.exenpm.exe文件来检查这一点。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我尝试在 Visual Studio Code 的终端中使用 Node.js 时,我收到“文档未定义”错误消息 - When I try to use Node.js in Visual Studio Code’s terminal, I get “document is not defined” error messages Node.js 错误 Visual Studio 代码中未找到模块错误 - Node.js error Module not found error in visual studio code 每当我尝试在 Visual Studio 代码上运行“npm install”时出现错误 - I get an error whenever i try to run "npm install" on visual studio code 如何通过附加到正在运行的进程来使用Visual Studio Code在Node上调试Express js服务器代码 - How to debug Express js server code on Node using Visual Studio Code by Attaching to running process Node.js v6.0.0上Visual Studio代码(F5)上的Cluster问题 - Issue with Cluster on Visual studio code (F5) on Node.js v6.0.0 如何在 Visual Studio Code 中因缺少导入而突出显示错误? - How can I get error highlighting for missing imports in Visual Studio Code? 当我在Visual Studio 2017中使用Node.js交互式窗口时,为什么会出现“SyntaxError:Unexpected identifier”错误? - Why do I get a “SyntaxError: Unexpected identifier” error when I use the Node.js Interactive Window in Visual Studio 2017? 我在 javascript 文件中的 Visual Studio 代码中遇到错误 - i am getting an error in visual studio code in javascript files 使用 Visual Studio 代码安装 npm 时出错 - Error when I use npm install with visual studio code js 在 codepen 中正常运行,但不是 Visual Studio 代码 - js running properly in codepen but not visual studio code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM