From 4f5c2deb4cae77dff98c040e43c18d37fb2cc553 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Tue, 26 Apr 2022 14:48:52 -0500 Subject: [PATCH] Add note about lockfile causing swc to fail to load (#36484) * Add note about lockfile causing swc to fail to load * Apply suggestions from code review Co-authored-by: Maia Teegarden --- errors/failed-loading-swc.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/errors/failed-loading-swc.md b/errors/failed-loading-swc.md index 0e7d90d60305..46f691de4417 100644 --- a/errors/failed-loading-swc.md +++ b/errors/failed-loading-swc.md @@ -14,6 +14,10 @@ On Windows make sure you have Microsoft Visual C++ Redistributable installed. ht Alternatively, you might need to allow optional packages to be installed by your package manager (remove `--no-optional` flag) for the package to download correctly. +In some cases your package manager (e.g. `npm`) might have generated a lockfile that only includes `optionalDependencies` specific to the platform it was generated on, preventing the `optionalDependency` needed for CI from being installed. + +This can be fixed by removing the lockfile and regenerating it with a newer version of your package manager `npm i -g npm@latest`. + If SWC continues to fail to load you can opt-out by disabling `swcMinify` in your `next.config.js` or by adding a `.babelrc` to your project with the following content: ```json