You can run NPM commands in VSCode terminal.

huangapple go评论65阅读模式
英文:

how can I run NPM commends in VSCode terminal

问题

我刚刚从扩展中在VSCode中安装了npm,但我不知道如何激活它。
我想在终端中运行npm init命令,但出现了以下错误:
"npm" 未被识别为 cmdlet、函数、脚本文件或可执行程序的名称。
请检查名称的拼写,或者如果包含了路径,请验证路径是否正确,然后重试。
在第1行第1个字符处:

  • npm init

我尝试重新启动VS Code,但仍然不起作用。

英文:

i just installed npm in VSCode from extantions and I don't know how to activate it.
i want to run the command npm init in terminal but I get this error :
The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • npm init

I tried restarting VS code but it's still not working.

答案1

得分: 1

打开 Visual Studio Code(VSCode)。

通过选择 "文件" -> "打开文件夹" 并选择项目所在的文件夹,打开您的项目文件夹。

一旦您的项目打开,点击 VSCode 窗口顶部的 "视图" 菜单,选择 "终端"。这将打开 VSCode 中的集成终端。

默认情况下,集成终端会以命令提示符形式打开。要切换到支持 npm 命令的终端,请点击终端名称旁边的下拉箭头(通常标有 "cmd" 或 "Powershell")并选择 "选择默认 shell"。选择 "Git Bash" 或您喜欢的其他 shell。

现在,您可以在 VSCode 终端中运行 npm 命令。只需键入您想运行的 npm 命令,比如 "npm install" 来安装依赖,并按回车键来执行命令。

英文:

Open visual Studio Code (VSCode).

Open your venture folder in VSCode by means of selecting "file" -> "Open Folder" and deciding on the folder wherein your assignment is placed.

Once your mission is open, click on the "View" menu on the top of the VSCode window and pick out "Terminal" from the dropdown menu. This can open the incorporated terminal inside VSCode.

By means of default, the incorporated terminal opens as a command prompt. To switch to a terminal that helps npm commands, click on on the dropdown arrow subsequent to the terminal's name (usually labeled "cmd" or "Powershell") and pick out "choose Default Shell." pick out "Git Bash" or any shell that you decide upon.

Now, you can run npm commands in the VSCode terminal. Sincerely type your preferred npm command, which includes "npm installation" to put in dependencies, and press input to execute the command.

答案2

得分: 0

你似乎还没有安装NPM。 前往安装Node.js到您的系统,因为您将需要它,它还会为您安装NPM。

https://nodejs.org/ <-- 在这里下载并安装LTS版本

英文:

Sounds like you haven't installed NPM yet. Go and install Node.js on your system since you will need that, and it will also install NPM for you.

https://nodejs.org/ <-- Download and install the LTS version here

huangapple
  • 本文由 发表于 2023年5月14日 03:21:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76244511.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定