The error indicates that PowerShell's execution policy is preventing the npx
command from running. This happens because script execution is disabled or restricted by default on your system.
-
Check Current Execution Policy: Run the following command to see your current execution policy:
Get-ExecutionPolicy
It might return something like
Restricted
. -
Set Execution Policy to Unrestricted or RemoteSigned: To allow scripts to run, change the execution policy:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
RemoteSigned
allows locally created scripts to run and requires downloaded scripts to be signed by a trusted publisher.- If
RemoteSigned
doesn't work, you can useUnrestricted
as a temporary measure:Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
-
Confirm the Change: Verify the new execution policy:
Get-ExecutionPolicy
-
Retry the Command: Run your
npx create-next-app@latest
command again.
- You only need to set this once unless the policy is reset.
- If you're working in a corporate environment, you might need administrator privileges or approval to change this setting.
- Avoid setting the execution policy to
Unrestricted
permanently as it can pose a security risk.