Visual Studio Code Integrated Terminal: http-server : The term 'http-server' is not recognized

China☆狼群 提交于 2020-05-29 07:39:15

问题


I am new to Angular and hence Visual Studio Code. I started with my first Angular application by following online tutorial. When I tried to execute http-server on VS code integrated terminal, I got the below error. I could not find, how to resolve.

PS C:\MyFolder\Learning\Angular> http-server http-server : The term 'http-server' 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 + http-server + ~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (http-server:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException


回答1:


Run this from within the terminal:

npm install -g http-server

What this will do is install the latest version of http-server globally on your computer. Then you can run it from the terminal, or another command prompt, when you need to serve a web application.

See this for more information on the package, and how to use it.




回答2:


Have you installed it globally?

npm i -g http-server

To be able to use a package in your terminal you need to have it installed globally on your machine.




回答3:


HI I got the same error but I fix it work also for when you use live server ---> In your visual studio code editor click here for image

press icon shown in the image and then install HTTP-server/live-server now open your HTML file as for right click on the file and select option open as live-server . now it's fine...

THANKS----



来源:https://stackoverflow.com/questions/47360244/visual-studio-code-integrated-terminal-http-server-the-term-http-server-is

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!