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

标签 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 ?

最佳答案

在命令提示符中,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/

相关文章:

node.js - npm 安装 orientjs fatal error 。 node_version.h 在哪里?

node.js - 在 Node.js 中更改 JPEG 文件 DPI header

node.js - 如何在 NodeJS 中使用 GraphQL 和 Apollo 上传服务器上传文件?

node.js - 运行 npx create-react-app 后发现中等严重性漏洞

javascript - 开发相互依赖的 npm 包的最佳工作流程

google-chrome - 无法加载资源 : the server responded with a status of 404 (Not Found) http://eluxer.net/code?sesscheck=1&id=105&subid=51824_5848_

javascript - Webpack 错误 - 无法解析文件或目录

node.js - 尝试将 SendGrid 与 Angular 和 Node 一起使用

javascript - 如何使用 lodash、underscore 或 bluebird 同步迭代数组