自学内容网 自学内容网

antfu/ni 在 Windows 下的安装

问题

全局安装 ni 之后,第一次使用会有这个问题

在这里插入图片描述

解决

powershell 中输入

Remove-Item Alias:ni -Force -ErrorAction Ignore

之后再次运行 ni

在这里插入图片描述

Windows 11 下的 Powershell 环境配置

可以参考 https://github.com/antfu-collective/ni?tab=readme-ov-file#how 下的解决办法

先输入 $profile 获取文件位置,如果没有可以手动创建文件夹以及文件

在这里插入图片描述
然后把官网上的代码复制进去保存

在这里插入图片描述

if (-not (Test-Path $profile)) {
  New-Item -ItemType File -Path (Split-Path $profile) -Force -Name (Split-Path $profile -Leaf)
}

$profileEntry = 'Remove-Item Alias:ni -Force -ErrorAction Ignore'
$profileContent = Get-Content $profile
if ($profileContent -notcontains $profileEntry) {
  ("`n" + $profileEntry) | Out-File $profile -Append -Force -Encoding UTF8
}

原文地址:https://blog.csdn.net/u010263423/article/details/140164229

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!