5

我的 Windows 机器没有管理员权限。我可以在没有管理员权限的情况下安装 NVM 吗?我尝试使用环境变量路径设置,但在我的情况下它不起作用。

4

3 回答 3

4

I have the same need and couldn't find one, so I created one base on another simple nvm:

https://www.npmjs.com/package/@jchip/nvm

Requires powershell 4+ and permission to execute scripts.

于 2019-06-26T08:17:07.703 回答
3

(You're talking about https://github.com/coreybutler/nvm-windows right?)

Whether you can install it without admin rights aside, the actual act of switching node versions with it requires them so you're going to have trouble.

Your best bet is to install different versions of node into different paths manually, and then configure your environment variables to point to the right one whenever you need to use it.

eg. prefix your cmd script with PATH=C:\node\v10;%PATH% to have any node or npm calls in that script use whatever node is sitting in v10

于 2018-09-06T18:24:59.630 回答
0

如果您在 Windows 上使用 Git Bash,您可以将其添加到您的 bash.bashrc 以切换节点版本:

export PATH=/c/path/to/node/dir:$PATH

然后只需重新启动终端以获取更新的 PATH。

它会在你的路径前面加上你想要的节点版本。如果您的机器上没有管理员权限,这是我发现覆盖已安装节点版本的唯一方法。

于 2020-11-19T21:30:35.243 回答