[英]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 :)谢谢 :)
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.我认为它应该在ProgramFiles
或ProgramFiles x86
中,但是您可以通过使用文件资源管理器转到您放入环境变量的文件路径并检查那里是否有node.exe
或npm.exe
文件来检查这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.