- Add detailed Windows build instructions to troubleshooting guide - Document requirement for Visual Studio 2022 Spectre-mitigated libraries - Add Windows build scripts (build:win, build:win:x64) to package.json - Add Windows configuration for electron-builder (NSIS installer) - Update README to highlight Windows prerequisites - Bump version to 0.3.4 This addresses the common build error on Windows where users encounter "LINK : fatal error LNK1181: cannot open input file 'MSVCRT.lib'" due to missing Spectre-mitigated libraries. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2.3 KiB
Setup Troubleshooting Guide
Python distutils Error
If you encounter this error during pnpm run setup:
ModuleNotFoundError: No module named 'distutils'
This happens because Python 3.12+ removed the distutils module that node-gyp depends on.
Quick Fix:
brew install python-setuptools
Alternative Solutions:
-
Use Python 3.11 with pyenv:
brew install pyenv pyenv install 3.11.9 pyenv global 3.11.9 -
Use the setup script:
./setup-dev.sh
Other Common Issues
electron-rebuild failures
- Ensure Xcode Command Line Tools are installed:
xcode-select --install - Clear node_modules and reinstall:
rm -rf node_modules && pnpm install
pnpm permission errors
- Never use
sudowith pnpm - Fix npm permissions:
npm config set prefix ~/.npm-global
Windows Build Requirements
Spectre-mitigated Libraries Error
If you encounter this error during pnpm run setup on Windows:
LINK : fatal error LNK1181: cannot open input file 'MSVCRT.lib'
Or similar errors mentioning missing .lib files, this means you need to install the Spectre-mitigated libraries in Visual Studio.
Solution:
-
Install Visual Studio 2022 (Community Edition is free):
- Download from https://visualstudio.microsoft.com/
-
Install Required Components:
- Open Visual Studio Installer
- Click Modify on your Visual Studio 2022 installation
- Go to the Individual components tab
- Search for "Spectre" in the search box
- Check the following components:
MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)MSVC v143 - VS 2022 C++ ARM64/ARM64EC Spectre-mitigated libs (Latest)(if building for ARM64)
- Click Modify to install
-
Restart your terminal and run
pnpm run setupagain
Why is this needed?
Node.js native modules on Windows are built with Visual Studio's C++ compiler. Recent security updates require Spectre-mitigated libraries to be installed separately. These libraries provide protection against Spectre vulnerability exploits.
Alternative: Use Pre-built Binaries
If you're having trouble with the build process, consider waiting for official Windows binaries to be released in future versions of Crystal.