安装Node.js和npm后如何运行实时服务器

时间:2020-04-16 12:20:44

标签: node.js npm npm-live-server

我正在使用Windows 10,并且已经在本地计算机上安装了Node.js(使用npm)。我正在尝试遵循一条指示:

"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”。

我现在对它说“从根/ code文件夹在终端中运行live-server”的部分感到困惑。

root /code folder是什么?

1 个答案:

答案 0 :(得分:3)

在命令提示符下,无论是cmd.com还是Windows终端机(是的,new one的名称中实际上都有the word "terminal"),cd到您的项目目录(由docs作为“根”或“代码”文件夹),然后键入:

live-server

它实际上是作为命令安装的,就像cddir等一样。

“根”文件夹或“代码”文件夹实际上是保存index.html文件的文件夹。