This issue stems from Windows PowerShell's script execution policy, which restricts certain scripts from running for security reasons.

In this article, I'll walk you through the simple steps to resolve this error, whether by adjusting your execution policy, switching to a different terminal, or using alternative methods to run your Node.js commands. Say goodbye to script restrictions and get back to building with ease!

This is a PowerShell execution policy error on Windows. Let's fix it step by step:

  1. Open PowerShell as Administrator:
    • Press Windows key
    • Type "PowerShell"
    • Right-click "Windows PowerShell" or "PowerShell"
    • Select "Run as administrator"
  2. Check your current execution policy:
Get-ExecutionPolicy
  1. Set the execution policy to allow scripts to run:
Set-ExecutionPolicy RemoteSigned
  • When prompted, type "Y" and press Enter
  1. Now you should be able to run the create-next-app command. Try again:
npx create-next-app@latest media-kit-poc --typescript --tailwind --eslint --app

Alternative solutions if you prefer not to change the execution policy:

  1. Use Command Prompt (cmd.exe) instead of PowerShell:
    • Press Windows key
    • Type "cmd"
    • Run the same npx command in Command Prompt
  2. Or use the longer command in PowerShell:
nodejs/node.exe nodejs/node_modules/npm/bin/npx-cli.js create-next-app@latest media-kit-poc --typescript --tailwind --eslint --app

You are all set up and ready to code awesome stuff 😸

Share this post