我使用的是 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
?
最佳答案
在命令提示符中,cmd.com 或 Windows 终端(是的,new one 实际上在其名称中包含 the word "terminal"),cd
到您的项目目录(文档称为“根”或“代码”文件夹),然后键入:
live-server
它实际上是作为命令安装的,就像
cd
, dir
等等。“根”文件夹或“代码”文件夹实际上就是您保存
index.html
的文件夹。文件。
关于node.js - 如何在 Node.js 和 npm 安装后运行实时服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61250124/