Packages
The term 'Package\Install-Package' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Cause:
You may receive this message when you are creating a package that implements a specifc command but it does not exist in the script.
For example, you create a package that implements the Install and Update commands. They should be implemented in the Package.psm1 file, with the Install-Package function:
$Package = @{
Id = 'example-app'
Name = 'Example App'
Version = '1.0.0'
Commands = @{
Install = 'Package.psm1:Install-Package'
Update = 'Package.psm1:Install-Package'
}
...
}
...
However, the Package.psm1 does not include a function called Install-Package.
Resolution:
To resolve this problem, use any one of the following methods, depending on the cause of the problem:
- Make sure the Package.psm1 exists in the package.
- Make sure the Package.psm1 file has a function called Install-Package.