A Developer's Quick Guide to Setting Up a Seamless Windows Environment for TypeScript and NodeJS.
Every developer hits this wall eventually: You try to run an npm script or the TypeScript compiler (tsc), and PowerShell greets you with a red block of text saying "Scripts are disabled on this system." Even worse, you try to fix it, and you get an "Access to the registry key is denied" error.
🔍 The Problem
By default, Windows restricts script execution for security. When you try to change the LocalMachine policy without high-level Admin rights, the system blocks you from touching the Registry.
✅ The Solution
You don't need to fight the "LocalMachine" registry. By targeting the CurrentUser scope, you can unlock your terminal immediately without needing "System" permissions.
🛠️ The Ultimate Setup Checklist
Copy and paste these commands into your VS Code terminal to get everything running smoothly.
- Unlock Script Execution (The "Access Denied" Fix) Run this first to allow npm and tsc to run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
- Verify Your Environment Now that the path is clear, check your versions to ensure everything is linked correctly:
node -v — Checks Node.js version
npm -v — Checks Node Package Manager version
tsc -version — Checks TypeScript Compiler version
- Global TypeScript Installation If tsc isn't recognized yet, install it globally:
npm install -g typescript
- Fresh Project Initialization Start your TypeScript journey with these two essentials:
npm init -y — Creates your package.json
tsc --init — Creates your tsconfig.json
💡 Pro-Tip for New Developers
If you are still seeing the error after running the commands, restart VS Code. The terminal needs a fresh start to "see" the new permissions you just granted it.
Top comments (0)