electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.47k stars 513 forks source link

Error running app with node-sass #2056

Closed noctera closed 3 years ago

noctera commented 3 years ago

Preflight Checklist

Issue Details

Expected Behavior

I´m using electron-forge with webpack and React. I wanted to add SASS to it so I installed node-sass (Version: ^5.0.0) and sass-loader.

Actual Behavior

Unfortunately the package is being rebuild on npm run start with electron-rebuild, which is throwing this error.

gyp: Call to 'node -e "require('nan')"' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild '/home/julian/Files/Programmieren/Vocascan/vocascan-desktop/node_modules/node-sass'.
Error: `gyp` failed with exit code: 1

Error: node-gyp failed to rebuild '/home/julian/Files/Programmieren/Vocascan/vocascan-desktop/node_modules/node-sass'.
Error: `gyp` failed with exit code: 1

    at ModuleRebuilder.rebuildNodeGypModule (/home/julian/Files/Programmieren/Vocascan/vocascan-desktop/node_modules/electron-rebuild/lib/src/module-rebuilder.js:193:19)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
    at async Rebuilder.rebuildModuleAt (/home/julian/Files/Programmieren/Vocascan/vocascan-desktop/node_modules/electron-rebuild/lib/src/rebuild.js:183:9)
    at async Rebuilder.rebuild (/home/julian/Files/Programmieren/Vocascan/vocascan-desktop/node_modules/electron-rebuild/lib/src/rebuild.js:145:17)
    at async /home/julian/Files/Programmieren/Vocascan/vocascan-desktop/node_modules/electron-rebuild/lib/src/cli.js:145:9

When installing node-sass and deleting it from my package.json, so it doesn´t get recogniced and recompiled, everything worked. So my question is either how to fix this error or how to disable the rebuild of the native package on startup. Maybe someone could help me with this.

malept commented 3 years ago

This is a question, not a bug and being helped in the Discord channel.

noctera commented 3 years ago

If someone encounters the same problem, node-sass is deprecated and should be replaced by dart-sass

https://github.com/sass/dart-sass