无法将 npm 终端设置为 VS 代码/windows

unable to set npm terminal into VS code / windows

我想安装react,所以我搜索了一下,发现必须先下载npm 所以我去下载 npm,我看到我必须下载节点并在 VS 代码终端中设置它

我下载 nodejs.zip 但它在这个路径 C:\node\node.exe 之后我去cmd写了node -v,回复:

'node' is not recognized as an internal or external command, operable program or batch file.

然后我去控制面板写了系统变量的路径 同样的事情发生了

我在 Whosebug 中搜索,我发现我最常在 cmd 中写 SET PATH=C:\node\node.exe;%PATH% 它工作但没有一段时间,在重新启动 PC 后错误仍然存​​在

然后我像这样将节点路径添加到 settings.json 文件

"terminal.integrated.profiles.windows": {
    .
    .
    .
    "Node Js": {
        "path": "C:\node\node.exe"
    }
},

并设为默认值

"terminal.integrated.defaultProfile.windows": "Node Js",

最后,现在我可以 运行 在 VS 代码中节点“好节奏”

但是... 当我在节点终端回复中写 node -v 时:

Uncaught ReferenceError: node is not defined

npm init react-app myApp:

npm should be run outside of the Node.js REPL, in your normal shell. (Press Ctrl+D to exit.)

以及 npx create-react-app hi

npx create-react-app hi

^ ^ ^ ^ ^ ^ //pointing on create

Uncaught SyntaxError: Unexpected identifier

我只想运行这个npm init react-app myAppnpm init react-app myApp命令 用于节点或其他任何东西的 IDC

我尝试从 this link

下载 node.msi安装文件

当您执行 SET PATH 时,它会为会话设置变量,但如果您希望它永久存在,请将路径放入全局 PATH 变量中。请参阅 this link 了解如何操作。简而言之,在命令提示符中设置变量允许您在当前命令提示符会话中使用该变量,并在您关闭命令提示符时取消设置(或者在这种情况下,设置回默认值)。 Windows 有一些您可以设置的环境变量,它们会在您启动命令提示符时自动加载,Path 就是其中之一。或者,您也可以按照您所说的去做,并使用 .msi 文件来完成这项工作。