繁体   English   中英

无法在 linux 上安装 Azure Az PowerShell 模块

[英]Cannot install the Azure Az PowerShell module on linux

I would like to install the Azure Az PowerShell module on Linux following the instructions from the page Install the Azure Az PowerShell module . 如果我更改为非 root 用户,并执行命令:

Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force

我明白了

Install-PackageProvider: Unhandled Exception - Message:'The type initializer for 'Microsoft.PackageManagement.Internal.Utility.Extensions.FilesystemExtensions' threw an exception.'
Name:'TypeInitializationException' Stack Trace:'   at Microsoft.PackageManagement.Internal.Utility.Extensions.FilesystemExtensions.MakeSafeFileName(String input) 
...

PS /root> $PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      2      1    

PS /home/user> $env:PSModulePath
/home/user/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/opt/microsoft/powershell/7/Modules

乍一看,我觉得好像存在权限问题,但我找不到根本原因。 任何想法?

提前致谢!

它是由 /tmp/Microsoft.PackageManagement 的所有权引起的。 只有 root 和创建它的非 root 用户能够安装模块。

删除此目录可以缓解问题,但当然,仅适用于创建它的用户。

https://github.com/OneGet/oneget/issues/400

暂无
暂无

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

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