VuePress入门教程运行出现乱码问题求助
Hey there, I’ve run into similar encoding headaches with VuePress on Windows before—let’s get this sorted out for you. The garbled output like ��#� �H�e�l�l�o� �V�u�e�P�r�e�s�s� is almost always tied to a mismatch between VuePress’s UTF-8 encoding and your Windows terminal’s default GBK setting. Here’s how to fix it step by step:
1. Quick Temporary Fix: Switch PowerShell to UTF-8
Open your PowerShell and run this command first to flip the terminal to UTF-8 encoding:
chcp 65001
Then re-run your VuePress dev command:
vuepress dev
This should clear up the garbled text right away for your current session.
2. Permanent Fix: Set PowerShell to Use UTF-8 by Default
If you don’t want to run that chcp command every time, set PowerShell to default to UTF-8:
- Right-click the PowerShell title bar and select Properties (or Settings on newer Windows 10 builds)
- Head to the Terminal or Options tab (depending on your Windows version)
- Find the Encoding dropdown and pick UTF-8
- Save changes and restart PowerShell
3. Verify Your Markdown Files Are UTF-8 Encoded
Double-check your content files (like README.md) are saved with UTF-8:
- Open the file in Notepad
- Go to File > Save As
- In the encoding dropdown, select UTF-8
- Overwrite the original file
4. (Optional) Upgrade Node.js (If You’re Open to It)
While Node.js v8.11.4 meets VuePress 1.x’s minimum requirements, older Node versions can have edge-case encoding bugs. If the above steps don’t work, consider upgrading to Node.js v12 or later—it’s free and simple, and might eliminate version-related quirks.
Try these steps in order—most users fix the problem with just the first two!
内容的提问来源于stack exchange,提问作者Randy Hall

