【发布时间】:2014-08-15 09:27:52
【问题描述】:
使用 npm 安装了“http-server”模块后,我只能以管理员身份启动 powershell 才能运行它。
例如:
npm install -g http-server
似乎工作正常,但是:
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-server”会按预期启动服务器。
如何安装 npm/node http-server 以在 powershell 未以管理员身份运行时可用?
重复警察:这与this question 非常相似,但问题不同(我的安装从一开始就是全局的),除非以管理员身份运行,否则那里的解决方案对我不起作用。
【问题讨论】:
-
http-server使用端口 80 吗?使用端口 80 不需要管理员权限吗? -
默认使用 8080,是否有同样的限制?
-
$ENV:Path以管理员身份运行与普通用户运行时是否不同? -
arco44 可能在正确的路径上 - 这个错误仅仅意味着它无法将该字符串与命令或函数相关联...查看端口号太过分了。
-
@AndrewM 我相信不会。只有 1024 及以下端口需要管理员权限。
标签: node.js powershell npm