如何在 Node.js 和 npm 安装后运行实时服务器 [英] How to run live server after Node.js and npm installation

查看:68
本文介绍了如何在 Node.js 和 npm 安装后运行实时服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Windows 10,并且已经在我的本地机器上安装了 Node.js(带有 npm).我正在尝试遵循以下说明:

I am using Windows 10 and I have installed Node.js (with npm) on my local machine. I am trying to follow an instruction which says:

"Once node.js and npm are installed, run the following command in your terminal.

npm install -g live-server

This will install live-server⁵, a simple static server that has live reload built-in. To
start your server, run live-server in your terminal from the root /code folder —
it will even open a new browser window for you!"

因为我使用的是 Windows,所以我猜终端"的意思是命令提示符".所以,我已经从 C://提示符运行了npm install -g live-server".

Since I am on Windows, I guess "Terminal" means "Command Prompt". So, I have run the "npm install -g live-server" from C:// prompt.

我现在对在终端中从根/code 文件夹运行 live-server"的部分感到困惑.

I am now confused about the part where it says "run live-server in your terminal from the root /code folder".

什么是root/code 文件夹?

推荐答案

在命令提示符中,cmd.com 或 Windows 终端(是的,新的 实际上有 名称中的终端"一词),cd 到您的项目目录(文档称为root"或code"文件夹)然后输入:

In the command prompt, either cmd.com or Windows terminal (yes, the new one actually has the word "terminal" in its name), cd to your project directory (referred to by the docs as the "root" or "code" folder) then type:

live-server

它就像cddir 等一样直接作为命令安装

It is literally installed as a command just like cd, dir etc.

根"文件夹或代码"文件夹实际上就是您保存 index.html 文件的文件夹.

The "root" folder or "code" folder is literally the folder where you saved your index.html file.

这篇关于如何在 Node.js 和 npm 安装后运行实时服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆