简介

http-server:命令行http服务器

http-server是一个简单的零配置命令行http服务器。它足够强大,足以用于生产用途,但它既简单又易于**,可用于测试,本地开发和学习。

使用前提

  • http-server 基于node运行,需要安装nodeJs环境,可以自行百度
  • node自带的npm包管理器
  • 通过npm安装http-server

安装

npm install http-server -g

这将http-server在全局安装,以便可以从命令行运行。

安装后不能使用的问题:
http-server : 无法加载文件 C:\Users…\npm\http-server.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
解决之道

使用

在Project目录下直接运行 http-server 回车

更加详细的使用方法请查看 官网

有图有真相

http-server的安装和使用

解决方案

  1. 以管理员的身份 运行powershell (直接在开始栏中搜)
  2. 执行以下命令
    set-ExecutionPolicy RemoteSigned
  3. y进行确认
  4. 搞定 不放心可以查看 通过命令
    get-ExecutionPolicy

图==真相

http-server的安装和使用

相关文章:

  • 2021-04-16
  • 2021-10-13
  • 2022-12-23
  • 2022-03-02
  • 2021-05-09
  • 2021-10-04
  • 2022-02-04
  • 2021-11-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-08
  • 2021-10-21
  • 2021-08-24
  • 2021-06-17
相关资源
相似解决方案