Nuxt项目部署至Vercel时遭遇node-fibers模块缺失问题求助
Hey there, let's work through this frustrating fibers issue you're facing with your Nuxt deployment on Vercel. Since you're new to SASS and this is your first deployment with it, the root cause is likely tied to how node-sass (which relies on fibers) interacts with Vercel's build environment. Here's what's going wrong and actionable fixes to try:
Why This Happens
The error is telling you that the precompiled fibers.node binary for Vercel's Linux environment is missing. This happens because:
node-sassuses platform-specific binary files, and the one you installed locally (probably on Windows/macOS) doesn't match Vercel's Linux server.fibersis a dependency ofnode-sassto speed up compilation, but it often fails to cross-compile correctly in CI/CD environments like Vercel.- On top of that,
node-sassis deprecated—it's no longer maintained, which means these compatibility issues will keep popping up.
Recommended Fixes (Ordered by Effectiveness)
1. Switch from node-sass to sass (Dart-Sass)
This is the most reliable long-term fix, since Dart-Sass is the official replacement for node-sass and doesn't require fibers at all. Here's how:
- Uninstall the old dependencies:
npm uninstall node-sass fibers # Or if you use yarn: yarn remove node-sass fibers - Install the modern SASS package:
npm install sass # Or yarn add sass - Update your Nuxt config (
nuxt.config.js) to remove any references tonode-sass. For example, if you had a loader config like this:
Delete that block or replacebuild: { loaders: { sass: { implementation: require('node-sass') } } }require('node-sass')withrequire('sass')—though Nuxt should automatically detectsassif it's installed.
2. Clean Dependencies and Cache
Sometimes leftover files from local installs cause mismatches. Do a fresh install:
- Delete your
node_modulesfolder, lock file, and Nuxt build cache:rm -rf node_modules package-lock.json .nuxt # For yarn: rm -rf node_modules yarn.lock .nuxt - Reinstall dependencies:
npm install # Or yarn install
3. Force Fibers to Recompile on Vercel (If You Must Keep node-sass)
If you can't switch to Dart-Sass right now, you need to tell Vercel to rebuild fibers during the build process:
- Add a
prebuildscript to yourpackage.jsonto compile fibers before running Nuxt build:"scripts": { "prebuild": "node node_modules/fibers/build", "build": "nuxt build" } - Ensure Vercel uses the same Node.js version as your local environment. Add this to
package.json:
The error mentions"engines": { "node": "16.x" }linux-x64-93-glibc, which corresponds to Node.js 16 (since v8 engine version 93 is bundled with Node 16). - In your Vercel project settings, double-check that the build command is set to
npm run build(oryarn buildif you use yarn) so it runs the prebuild step.
4. Check for Unnecessary Fibers Imports
Double-check your nuxt.config.js (or any other config files) to make sure you aren't manually importing fibers somewhere. Old tutorials or configs might have lines like require('fibers')—remove those if they exist.
Final Notes
Sticking with Dart-Sass is strongly recommended, as node-sass has been deprecated since 2020 and won't receive updates for newer Node.js versions. This will prevent similar issues in future deployments.
内容的提问来源于stack exchange,提问作者Nicolas

