npm 如何在windows中安装nvm?

5uzkadbs  于 2023-10-19  发布在  Windows
关注(0)|答案(2)|浏览(155)

我已经厌倦了使用cURL命令安装nvm:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash

我已经安装了nvm,但我无法使用nvm命令:

$ nvm --version
bash: nvm: command not found

如果我尝试更新nvm,

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13527  100 13527    0     0  15441      0 --:--:-- --:--:-- --:--:-- 15441
=> nvm is already installed in /c/Users/VIJAY R/.nvm, trying to update using git
=> error: invalid path 'test/fast/Aliases/"nvm alias" should not accept aliases with slashes'
=> Compressing and cleaning up git repository

=> nvm source string already in /c/Users/VIJAY R/.bash_profile
=> bash_completion source string already in /c/Users/VIJAY R/.bash_profile
main: line 397: /c/Users/VIJAY R/.nvm/nvm.sh: No such file or directory
npm ERR! missing: @babel/code-frame@^7.0.0, required by [email protected]        
npm ERR! missing: eslint-scope@^5.0.0, required by [email protected]
npm ERR! missing: eslint-visitor-keys@^1.1.0, required by [email protected]      
npm ERR! missing: espree@^6.1.2, required by [email protected]
npm ERR! missing: esquery@^1.0.1, required by [email protected]
npm ERR! missing: esutils@^2.0.2, required by [email protected]
npm ERR! missing: functional-red-black-tree@^1.0.1, required by [email protected]
npm ERR! missing: ignore@^4.0.6, required by [email protected]
npm ERR! missing: import-fresh@^3.0.0, required by [email protected]
npm ERR! missing: imurmurhash@^0.1.4, required by [email protected]
npm ERR! missing: json-stable-stringify-without-jsonify@^1.0.1, required by [email protected]
npm ERR! missing: levn@^0.3.0, required by [email protected]
npm ERR! missing: natural-compare@^1.4.0, required by [email protected]
npm ERR! missing: progress@^2.0.0, required by [email protected]
npm ERR! missing: regexpp@^2.0.1, required by [email protected]
npm ERR! missing: table@^5.2.3, required by [email protected]
npm ERR! missing: text-table@^0.2.0, required by [email protected]
npm ERR! missing: v8-compile-cache@^2.0.3, required by [email protected]
npm ERR! missing: fast-deep-equal@^2.0.1, required by [email protected]
npm ERR! missing: fast-json-stable-stringify@^2.0.0, required by [email protected]
npm ERR! missing: json-schema-traverse@^0.4.1, required by [email protected]       
npm ERR! missing: uri-js@^4.2.2, required by [email protected]
npm ERR! missing: esutils@^2.0.2, required by [email protected]
npm ERR! missing: eslint-visitor-keys@^1.1.0, required by [email protected]
npm ERR! missing: flatted@^2.0.0, required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: type-fest@^0.8.1, required by [email protected]
npm ERR! missing: cli-width@^2.0.0, required by [email protected]
npm ERR! missing: emoji-regex@^8.0.0, required by [email protected]
npm ERR! missing: deep-is@~0.1.3, required by [email protected]
npm ERR! missing: levn@~0.3.0, required by [email protected]
npm ERR! missing: prelude-ls@~1.1.2, required by [email protected]
npm ERR! missing: type-check@~0.3.2, required by [email protected]
npm ERR! missing: word-wrap@~1.2.3, required by [email protected]
npm ERR! missing: @babel/code-frame@^7.0.0, required by [email protected]
npm ERR! missing: eslint-scope@^5.0.0, required by [email protected]
npm ERR! missing: eslint-visitor-keys@^1.1.0, required by [email protected]
npm ERR! missing: espree@^6.1.2, required by [email protected]
npm ERR! missing: esquery@^1.0.1, required by [email protected]
npm ERR! missing: esutils@^2.0.2, required by [email protected]
npm ERR! missing: functional-red-black-tree@^1.0.1, required by [email protected]
npm ERR! missing: ignore@^4.0.6, required by [email protected]
npm ERR! missing: import-fresh@^3.0.0, required by [email protected]
npm ERR! missing: imurmurhash@^0.1.4, required by [email protected]
npm ERR! missing: json-stable-stringify-without-jsonify@^1.0.1, required by [email protected]
npm ERR! missing: levn@^0.3.0, required by [email protected]
npm ERR! missing: natural-compare@^1.4.0, required by [email protected]
npm ERR! missing: progress@^2.0.0, required by [email protected]
npm ERR! missing: regexpp@^2.0.1, required by [email protected]
npm ERR! missing: table@^5.2.3, required by [email protected]
npm ERR! missing: text-table@^0.2.0, required by [email protected]
npm ERR! missing: v8-compile-cache@^2.0.3, required by [email protected]
npm ERR! missing: fast-deep-equal@^2.0.1, required by [email protected]
npm ERR! missing: fast-json-stable-stringify@^2.0.0, required by [email protected]
npm ERR! missing: json-schema-traverse@^0.4.1, required by [email protected]
npm ERR! missing: uri-js@^4.2.2, required by [email protected]
npm ERR! missing: esutils@^2.0.2, required by [email protected]
npm ERR! missing: eslint-visitor-keys@^1.1.0, required by [email protected]
npm ERR! missing: mimic-fn@^2.1.0, required by [email protected]
npm ERR! missing: emoji-regex@^8.0.0, required by [email protected]
npm ERR! missing: flatted@^2.0.0, required by [email protected]
npm ERR! missing: [email protected], required by [email protected]
npm ERR! missing: type-fest@^0.8.1, required by [email protected]
npm ERR! missing: deep-is@~0.1.3, required by [email protected]
npm ERR! missing: levn@~0.3.0, required by [email protected]
npm ERR! missing: prelude-ls@~1.1.2, required by [email protected]
npm ERR! missing: type-check@~0.3.2, required by [email protected]
npm ERR! missing: word-wrap@~1.2.3, required by [email protected]
npm ERR! missing: chai@^4.1.2, required by [email protected]
npm ERR! missing: deep-equal@^1.0.0, required by [email protected]
npm ERR! missing: json-stringify-safe@^5.0.1, required by noc[email protected]
npm ERR! missing: propagate@^1.0.0, required by [email protected]
npm ERR! missing: qs@^6.5.1, required by [email protected]
=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:

C:\Users\VIJAY R\AppData\Roaming\npm
+-- @angular/[email protected]
+-- [email protected]
`-- [email protected]
=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:

     $ nvm use system
     $ npm uninstall -g a_module

=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
zaqlnxep

zaqlnxep1#

来自nvm文档的重要说明部分:
注意:nvm不支持Windows(参见#284),但可以在WSL(用于Linux的Windows子系统)中工作,具体取决于WSL的版本。对于Windows,有两种替代方案,我们既不支持也不开发:

  • nvm-windows
  • 结瘤学家

你可能会有更好的运气尝试nvm-windowsnodist

jm2pwxwz

jm2pwxwz2#

我建议你使用nvs。通过Chocolatey包管理器安装它。

相关问题