Windows PowerShell
A cross-platform task automation and configuration management framework developed by Microsoft. It consists of a command-line shell and an associated scripting language, and is one of the default command-line tools on Windows systems.
Timeline (last 90 days)
The common reason npm -v errors out on first run on Windows is that PowerShell's script execution policy restricts unsigned scripts by default; entering the prompted command and confirming releases the restriction, so this is a configuration issue rather than a corrupted installation.
Windows PowerShell defaults to the system code page (e.g., GBK/CP936 in Chinese environments, CP932 in Japanese environments), while modern CLI tools generally read and write stdin/stdout as UTF-8, causing garbled non-ASCII characters when passed through pipes.
To fix non-ASCII pipe garbling in PowerShell, you must set all three of [Console]::InputEncoding, [Console]::OutputEncoding, and $OutputEncoding to UTF-8.
PowerShell does not support cmd-style & command chaining and will throw an AmpersandNotAllowed error.
All Facts (4)
The common reason npm -v errors out on first run on Windows is that PowerShell's script execution policy restricts unsigned scripts by default; entering the prompted command and confirming releases the restriction, so this is a configuration issue rather than a corrupted installation.
60%UnverifiedWindows PowerShell defaults to the system code page (e.g., GBK/CP936 in Chinese environments, CP932 in Japanese environments), while modern CLI tools generally read and write stdin/stdout as UTF-8, causing garbled non-ASCII characters when passed through pipes.
50%UnverifiedTo fix non-ASCII pipe garbling in PowerShell, you must set all three of [Console]::InputEncoding, [Console]::OutputEncoding, and $OutputEncoding to UTF-8.
50%UnverifiedPowerShell does not support cmd-style & command chaining and will throw an AmpersandNotAllowed error.
50%