简体   繁体   English

沃尔特和全球 npm package

[英]Volta and global npm package

I try Volta tools on existing Node project.我在现有的 Node 项目上试用 Volta 工具。 This is very great tools:)这是非常棒的工具:)

But, can i use global package?但是,我可以使用全局 package 吗? For example, i've run:例如,我已经运行:

npm i -g gitmoji-cli

Then, i try to use gitmoji , but it's undefined on the command line.然后,我尝试使用gitmoji ,但它在命令行上未定义。 I'm on the right node version, but i don't really understand why the gitmoji is not found.我在正确的节点版本上,但我真的不明白为什么找不到 gitmoji。

Do you know if I need other param?你知道我是否需要其他参数吗?

If anyone have already use this tool and installing global package.. :)如果有人已经使用此工具并安装了全局 package.. :)

在此处输入图像描述

You can install global packages using volta install <package> .您可以使用volta install <package>安装全局包。 In your case, it would be volta install gitmoji-cli .在您的情况下,它将是volta install gitmoji-cli

Volta will then install the package and make it available anywhere in your terminal.然后,Volta 将安装 package 并使其在终端的任何位置可用。 However, if you open the terminal in a project that has that package listed as a dependency, or dev dependency, Volta will use the package from the node_modules of that project instead.但是,如果您在将 package 列为依赖项或开发依赖项的项目中打开终端,Volta 将使用该项目的 node_modules 中的node_modules代替。

For more information see: global-installs-done-right有关更多信息,请参阅: global-installs-done-right

Yes, Volta works Well with global package installation.是的,Volta 适用于全球 package 安装。

I try your command and it's OK:我试试你的命令,没关系:

npm i -g gitmoji-cli npm i -g gitmoji-cli

if it's not working for you, try openning "cmd" with "Run as administrator" option.如果它不适合您,请尝试使用“以管理员身份运行”选项打开“cmd”。

or, as volta documentation recommends, enable "Developer Mode" in Windows:或者,按照volta 文档的建议,在 Windows 中启用“开发人员模式”:

NOTE笔记

Volta's functionality depends on creating symlinks, so you must either: Volta 的功能取决于创建符号链接,因此您必须:

Enable Developer Mode (recommended)启用开发者模式(推荐)

Run Volta with elevated privileges (not recommended)以提升的权限运行 Volta(不推荐)

When you install a package to your toolchain, Volta takes your current default Node version and pins the tool to that engine当您将 package 安装到您的工具链时,Volta 将采用您当前的默认 Node 版本并将该工具固定到该引擎

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM