使用KotlinJS开发Google Chrome扩展时构建进程卡在60%的问题求助
Hey there, sorry to hear you're hitting this roadblock while working on your KotlinJS Chrome extension. Builds getting stuck at specific progress points are usually tied to cache issues, version conflicts, or Node.js-related quirks—let's walk through actionable fixes to get you past that 60% mark:
Common Fixes to Try
Update Gradle & Kotlin Versions
The sample project might rely on outdated versions with known hanging bugs. Head to your project'sbuild.gradle.kts(orbuild.gradle) and upgrade to the latest stable Kotlin JS plugin and compatible Gradle version. For example:plugins { kotlin("js") version "1.9.20" // Use the latest stable Kotlin version id("com.google.chrome.extension") version "1.0.1" // Match with a compatible extension plugin }Wipe Gradle Caches
Corrupted cache files are a frequent culprit for stuck builds. Run these commands to clean up and restart the build without cached data:# For macOS/Linux ./gradlew clean build --no-build-cache # For Windows gradlew.bat clean build --no-build-cacheDisable Parallel Build Execution
Parallel task execution can sometimes trigger deadlocks in Kotlin JS projects. Add this line to yourgradle.propertiesfile to turn it off temporarily:org.gradle.parallel=falseRe-run the build after making this change.
Check Node.js Compatibility
Kotlin JS depends on Node.js for bundling and processing. Ensure you're running a recent LTS version (v18 or v20 are recommended). Verify your current version with:node --versionIf you have multiple Node.js versions installed, use a version manager like nvm to switch to an LTS release.
Get Verbose Build Logs
Run the build with verbose logging to see exactly which task is hanging at 60%. This will help pinpoint the root cause:./gradlew build -infoKeep an eye out for tasks like
kotlinJsBrowserProductionWebpack—this is where most Kotlin JS build hangs tend to occur.Audit Dependencies
Outdated or conflicting dependencies can freeze the build process. Scan yourbuild.gradle.ktsfor deprecated libraries and replace them with modern alternatives. For Chrome extension-specific code, double-check that any Kotlin bindings for Chrome APIs are up-to-date.
If none of these steps resolve the issue, sharing the specific task name from the verbose logs or key details from your screenshot would help narrow things down further.
内容的提问来源于stack exchange,提问作者chirag patel

