Node.js 节点';http服务器';仅以powershell的管理员身份工作

Node.js 节点';http服务器';仅以powershell的管理员身份工作,node.js,powershell,npm,Node.js,Powershell,Npm,使用npm安装了“http服务器”模块后,我只能以管理员身份启动powershell才能运行它 例如: 看起来很好,但是: http-server 抛出错误: http-server : The term 'http-server' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path

使用npm安装了“http服务器”模块后,我只能以管理员身份启动powershell才能运行它

例如:

看起来很好,但是:

http-server
抛出错误:

http-server : The term 'http-server' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
但是,如果我以管理员身份启动powershell,“http服务器”将按预期启动服务器

当powershell不是以管理员身份运行时,如何安装npm/node http服务器以使其可用


重复策略:这与非常相似,但问题不同(我的安装从一开始就是全局性的),并且那里的解决方案不适合我,除非以管理员身份运行。

确保PATH环境变量包含到http服务器的路径。您可以在用户的powershell配置文件中执行此操作。您可以找到powershell配置文件的基本介绍

http服务器是否使用端口80?使用端口80不需要管理员权限吗?默认情况下,它使用8080,是否受相同的限制?作为管理员和普通用户运行时,
$ENV:Path
是否不同?arco44可能在正确的路径上-此错误只是意味着它无法将该字符串与命令或函数关联。。。看端口号太过分了。@AndrewM我想不会。只有1024个及以下端口需要admin priv。我已将其添加到环境变量中,但仍然面临相同的问题。你能帮助我吗
http-server : The term 'http-server' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.