简体   繁体   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 . I would like to install the Azure Az PowerShell module on Linux following the instructions from the page Install the Azure Az PowerShell module . If I change to a non-root user, and execute the command:如果我更改为非 root 用户,并执行命令:

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

I get我明白了

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) 
...

The

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

At first sight it looks to me as if there would be a permission problem, but I cannot find the root couse.乍一看,我觉得好像存在权限问题,但我找不到根本原因。 Any idea?任何想法?

Thanks in advance!提前致谢!

It is caused by ownership of /tmp/Microsoft.PackageManagement.它是由 /tmp/Microsoft.PackageManagement 的所有权引起的。 Only root and the nonroot user who created it were able to install modules.只有 root 和创建它的非 root 用户能够安装模块。

Deleting this directory mitigates the issue, but, of course, only for the user who creates it.删除此目录可以缓解问题,但当然,仅适用于创建它的用户。

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

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

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