Powershell中的模块嵌套限制是什么 [英] What is the module nesting limit in Powershell

查看:38
本文介绍了Powershell中的模块嵌套限制是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试在另一个脚本中导入 Powershell 模块时收到错误消息,但我似乎找不到有关该错误的任何文档.

I received an error while attempting to import a Powershell module in another script, but I cannot seem to find any documentation on the error.

错误:

无法加载模块AWSRestTools.psd1",因为已超出模块嵌套限制.模块只能嵌套 10 层.评估并更改加载模块的顺序以防止超出嵌套限制,然后再次尝试运行您的脚本.

Cannot load the module 'AWSRestTools.psd1' because the module nesting limit has been exceeded. Modules can only be nested to 10 levels. Evaluate and change the order in which you are loading modules to prevent exceeding the nesting limit, and then try running your script again.

我的模块AWSRestTools"未加载任何其他模块,因此不清楚嵌套"发生的位置.该错误提到重新排序加载的模块,但我不明白为什么.有人会介意阐明这个错误吗?为什么存在嵌套限制",重新排序模块会实现什么?

My module 'AWSRestTools' does not load any other modules, so it's unclear where the 'nesting' is occurring. The error mentions re-ordering the modules that are loaded, but I do not understand why. Would anyone mind shedding light on this error? Why is there a 'nesting limit', and what would reordering modules accomplish?

推荐答案

您需要引用清单中的 .psm1(或 .dll)文件...而不是清单文件本身 (.psd1).基本上,您将其放入循环中.

You need to reference the .psm1 (or .dll) file in the manifest... not the manifest file itself (.psd1). Basically, you're throwing it into a loop.

正确:

# Script module or binary module file associated with this manifest.
RootModule = 'Module.psm1'

这篇关于Powershell中的模块嵌套限制是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆