Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvm-desktop: command not found: {lib} #23

Closed
1111mp opened this issue Nov 22, 2023 · 5 comments
Closed

nvm-desktop: command not found: {lib} #23

1111mp opened this issue Nov 22, 2023 · 5 comments
Labels
documentation Improvements or additions to documentation stale

Comments

@1111mp
Copy link
Owner

1111mp commented Nov 22, 2023

This issue aims to explain why the nvm-desktop: command not found prompt message appears. Only applies to the following two situations:

  • Set the prefix option of npm. (npm config set prefix "/path/to/folder") That is the directory of the "npm" global installation package has been changed.
  • When using yarn or pnpm through corepack. (corepack enable --install-directory /path/to/folder) The directory where the executable is generated was changed via the --install-directory option.

Therefore, the error prompt of nvm-desktop: command not found in the terminal is in line with its respective default behavior. At this time, you need to manually add the /path/to/folder directory path to the system environment variable, and then terminal can be correctly identified. However, please note that when adding it to the system environment variable, you need to put the path of /path/to/folder before nvmd ($HOME/.nvmd/bin).

You can download a node version separately to test its respective default behavior without using nvm-desktop.


这个 issue 旨在解释为何出现 nvm-desktop: command not found 提示信息。 只适用于以下两种情况:

  • 设置过npmprefix选项。 (npm config set prefix "/path/to/folder") 即npm全局安装包的目录已更改。
  • 通过corepack使用yarnpnpm时。 (corepack enable --install-directory /path/to/folder) 通过 --install-directory 选项更改了可执行文件生成的目录。

终端中出现nvm-desktop: command not find的错误提示符合其各自的默认行为的。 这时需要手动将/path/to/folder目录路径添加到系统环境变量中,然后终端才能正确识别。不过请注意,在添加到系统环境变量的时候,需要将/path/to/folder的路径放在nvmd$HOME/.nvmd/bin) 之前。

你可以在不使用nvm-desktop的情况下单独下载一个node的版本到本地进行测试。当更改过npm的全局包安装路径以及通过corepack enable --install-directory /path/to/folder命令生成yarn&pnpm的可执行文件时,需要将其对应的路径添加到环境变量中之后终端才能够正确识别。

Reference:

When in global mode, executables are linked into {prefix}/bin on Unix, or directly into {prefix} on Windows. Ensure that path is in your terminal's PATH environment to run them.

Corepack is a zero-runtime-dependency Node.js script that acts as a bridge between Node.js projects and the package managers they are intended to be used with during development. In practical terms, Corepack lets you use Yarn, npm, and pnpm without having to install them.

corepack enable --install-directory /path/to/folder

Add the Corepack shims to the install directories

When run, this commmand will check whether the shims for the specified package
managers can be found with the correct values inside the install directory. If
not, or if they don't exist, they will be created.

By default it will locate the install directory by running the equivalent of
which corepack, but this can be tweaked by explicitly passing the install
directory via the --install-directory flag.

@rmd1710714107
Copy link

卸载后仍然出现nvm-desktop: command not found:node,这个如何解决?

@1111mp
Copy link
Owner Author

1111mp commented Nov 30, 2023

@rmd1710714107 根据文档完全卸载nvm-desktop: uninstall

@rmd1710714107
Copy link

@rmd1710714107 根据文档完全卸载nvm-desktop: uninstall

感谢,已解决

Copy link

This issue is stale because it has been open for 30 days with no activity.

Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation stale
Projects
None yet
Development

No branches or pull requests

2 participants