Skip to content

Conversation

@Nitin-100
Copy link
Contributor

@Nitin-100 Nitin-100 commented Nov 4, 2025

Description

Type of Change

Erase all that don't apply.

  • Bug fix (non-breaking change which fixes an issue)

Why

The build fails to enable developer mode during yarn react-native run-windows with a PowerShell error: "Export-ModuleMember : The Export-ModuleMember cmdlet can only be called from inside a module." This occurs because WindowsStoreAppUtils.ps1 contains Export-ModuleMember calls but is imported as a script rather than a module. The Export-ModuleMember cmdlet can only be used inside PowerShell modules (.psm1 files), not regular scripts (.ps1 files). This prevents the EnableDevmode function from being accessible, blocking app deployment and developer mode enablement.

Resolves #15297

What

  • Renamed WindowsStoreAppUtils.ps1 to WindowsStoreAppUtils.psm1 to make it a proper PowerShell module
  • Updated the file reference in deploy.ts from .ps1 to .psm1 extension
  • This allows PowerShell's Import-Module command to correctly load the module and makes all exported functions (EnableDevmode, Install-App, etc.) accessible

Screenshots

After(Fixed State) and Before(Broken state):

PS> Import-Module WindowsStoreAppUtils.psm1
SUCCESS: Module imported successfully

PS> Get-Command EnableDevmode
Name
----
EnableDevmode'''



Export-ModuleMember : The Export-ModuleMember cmdlet can only be called from inside a module.
At D:\Bugs\react-native-windows\packages\@react-native-windows\cli\src\powershell\WindowsStoreAppUtils.ps1:455 char:1
+ Export-ModuleMember -Function @(
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'''

Nitin Chaudhary added 2 commits November 4, 2025 13:48
Rename WindowsStoreAppUtils.ps1 to .psm1 and update reference.
Export-ModuleMember can only be used inside PowerShell modules.

Fixes microsoft#15297
@Nitin-100 Nitin-100 requested a review from a team as a code owner November 4, 2025 08:34
Copy link
Contributor

@protikbiswas100 protikbiswas100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Nitin-100 Nitin-100 merged commit 3c72af8 into microsoft:main Nov 4, 2025
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[0.80] Build fails to enable developer mode

2 participants