nvm 使用在 windows 中失败,用户名包含 space

nvm use fails in windows with a user name containing space

我的问题与 3 年前的这个问题有关。 nvm-windows fails when the user path contains a space 但是,none 这些解决方案对我有帮助。我的用户文件夹名称是 Sunita Dahal。 我成功安装了 nvm,我可以使用 nvm install 以及 nvm list。但是当我尝试做 nvm use <version> 它抛出我

C:\Users\Sunita Dahal>nvm use 8.0.0
exit status 1: 'C:\Users\Sunita' is not recognized as an internal or external command,
operable program or batch file.

我也更新了我的系统路径变量。

我之前也安装过node。这就是为什么我有路径 C:\Users\Sunita Dahal\AppData\Roaming\npm.

我通过将 nvm 中的 settings.txt 更新为 C:/Sunita~1/AppData/roaming/nvm 解决了这个问题。 有关更多信息,请访问 https://github.com/coreybutler/nvm-windows/issues/41

为 Rey young 的回答增加精确度:

您应该在 cmd 中,转到 c:\users 并键入 dir/x 以查看 Sunita Dahal 文件夹。

我叫 Dan Cissokho,我得到了 DANCIS~1 然后在 setting.txt.

中用这个缩短的名称替换您的用户名

就是这样。

不需要这样的 hack,我花了几个小时试图解决这个问题,none 这些解决方案对我有用。

我最后做的是将 nvm 安装在 c:\tools\ 目录中,如果不创建它,您可能已经有一个。重点是,只需将 nvm 安装在没有空格的短路径中即可。