question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with packaging as an native dependency and rebuilding with electron-rebuild -- bufferutils/node-gyp

See original GitHub issue

Bug report

Describe the bug

When adding @supabase/realtime-js to an electron project where the native dependencies have to be rebuild the install process fails due to bufferutil

To Reproduce

  1. Clone https://github.com/electron-react-boilerplate/electron-react-boilerplate
  2. Install the realtime library as a native dependency (see: https://electron-react-boilerplate.js.org/docs/native-modules)
  3. View error when running install

Expected behavior

Able to install and rebuild superbase successfully within electron project.

System information

  • OS: MacOS Big Sir
  • Version of supabase-js: latest
  • Python: Python 2.7.18
  • Python3: Python 3.9.7
  • Version of Node.js: v14.18.0

Additional context

Error Log:

running npm install -s “@supabase/supabase-js” in the native dependency directory installs the dependency but throws the below error during the electron-rebuild process:

`$ yarn electron-rebuild && yarn link-modules yarn run v1.22.10 $ node -r …/…/.erb/scripts/babel-register.js …/…/.erb/scripts/electron-rebuild.js ⠏ Building modules: 0/2Makefile:343: *** missing separator. Stop. Makefile:343: *** missing separator. Stop. ✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild node-gyp failed to rebuild ‘/Users/macbookpro/Documents/My-Company/app/app-desktop/build/app/node_modules/utf-8-validate’. For more information, rerun with the DEBUG environment variable set to “electron-rebuild”.

Error: make failed with exit code: 2

Error: node-gyp failed to rebuild ‘/Users/macbookpro/Documents/My-Company/app/app-desktop/build/app/node_modules/utf-8-validate’. For more information, rerun with the DEBUG environment variable set to “electron-rebuild”.

Error: make failed with exit code: 2

at NodeGyp.rebuildModule (/Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/electron-rebuild/lib/src/module-type/node-gyp.js:109:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ModuleRebuilder.rebuildNodeGypModule (/Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/electron-rebuild/lib/src/module-rebuilder.js:94:9) at async Rebuilder.rebuildModuleAt (/Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/electron-rebuild/lib/src/rebuild.js:226:9) at async Promise.all (index 177) at async Rebuilder.rebuild (/Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/electron-rebuild/lib/src/rebuild.js:180:13) at async /Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/electron-rebuild/lib/src/cli.js:154:9 node:child_process:903 throw err; ^

Error: Command failed: …/…/node_modules/.bin/electron-rebuild --parallel --force --types prod,dev,optional --module-dir . at checkExecSyncError (node:child_process:826:11) at execSync (node:child_process:900:15) at Object. (/Users/macbookpro/Documents/My-Company/app/app-desktop/.erb/scripts/electron-rebuild.js:17:3) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Module._compile (/Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/pirates/lib/index.js:99:24) macbookpro@MacbookPros-MBP app % yarn yarn install v1.22.10 [1/4] 🔍 Resolving packages… success Already up-to-date. $ yarn electron-rebuild && yarn link-modules yarn run v1.22.10 $ node -r …/…/.erb/scripts/babel-register.js …/…/.erb/scripts/electron-rebuild.js ⠇ Building modules: 0/2 CC(target) Release/obj.target/bufferutil/src/bufferutil.o CC(target) Release/obj.target/bufferutil/src/bufferutil.o ⠹ Building modules: 0/2error: /Library/Developer/CommandLineTools/usr/bin/lipo: can’t move temporary file: Release/obj.target/bufferutil/src/bufferutil.o to file: Release/obj.target/bufferutil/src/bufferutil.o.lipo (No such file or directory) clang: error: lipo command failed with exit code 1 (use -v to see invocation) make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1 ✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild node-gyp failed to rebuild ‘/Users/macbookpro/Documents/My-Company/app/app-desktop/build/app/node_modules/bufferutil’. For more information, rerun with the DEBUG environment variable set to “electron-rebuild”.

Error: make failed with exit code: 2

Error: node-gyp failed to rebuild ‘/Users/macbookpro/Documents/My-Company/app/app-desktop/build/app/node_modules/bufferutil’. For more information, rerun with the DEBUG environment variable set to “electron-rebuild”.

Error: make failed with exit code: 2

at NodeGyp.rebuildModule (/Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/electron-rebuild/lib/src/module-type/node-gyp.js:109:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ModuleRebuilder.rebuildNodeGypModule (/Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/electron-rebuild/lib/src/module-rebuilder.js:94:9) at async Rebuilder.rebuildModuleAt (/Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/electron-rebuild/lib/src/rebuild.js:226:9) at async Promise.all (index 91) at async Rebuilder.rebuild (/Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/electron-rebuild/lib/src/rebuild.js:180:13) at async /Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/electron-rebuild/lib/src/cli.js:154:9 node:child_process:903 throw err; ^

Error: Command failed: …/…/node_modules/.bin/electron-rebuild --parallel --force --types prod,dev,optional --module-dir . at checkExecSyncError (node:child_process:826:11) at execSync (node:child_process:900:15) at Object. (/Users/macbookpro/Documents/My-Company/app/app-desktop/.erb/scripts/electron-rebuild.js:17:3) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Module._compile (/Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/pirates/lib/index.js:99:24) at Module._extensions…js (node:internal/modules/cjs/loader:1153:10) at Object.newLoader [as .js] (/Users/macbookpro/Documents/My-Company/app/app-desktop/node_modules/pirates/lib/index.js:104:7) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) { status: 255, signal: null, output: [ null, null, null ], pid: 39612, stdout: null, stderr: null } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. SOLINK_MODULE(target) Release/bufferutil.node error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. macbookpro@MacbookPros-MBP app % clang: error: no such file or directory: ‘Release/obj.target/bufferutil/src/bufferutil.o’ make: *** [Release/bufferutil.node] Error 1 `

$ yarn electron-rebuild && yarn link-modules yarn run v1.22.10 $ node -r …/…/.erb/scripts/babel-register.js …/…/.erb/scripts/electron-rebuild.js ⠏ Building modules: 0/2Makefile:343: *** missing separator. Stop. Makefile:343: *** missing separator. Stop. ✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild node-gyp failed to rebuild ‘/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/build/app/node_modules/utf-8-validate’. For more information, rerun with the DEBUG environment variable set to “electron-rebuild”.

Error: make failed with exit code: 2

Error: node-gyp failed to rebuild ‘/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/build/app/node_modules/utf-8-validate’. For more information, rerun with the DEBUG environment variable set to “electron-rebuild”.

Error: make failed with exit code: 2

at NodeGyp.rebuildModule (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/electron-rebuild/lib/src/module-type/node-gyp.js:109:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ModuleRebuilder.rebuildNodeGypModule (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/electron-rebuild/lib/src/module-rebuilder.js:94:9) at async Rebuilder.rebuildModuleAt (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/electron-rebuild/lib/src/rebuild.js:226:9) at async Promise.all (index 177) at async Rebuilder.rebuild (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/electron-rebuild/lib/src/rebuild.js:180:13) at async /Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/electron-rebuild/lib/src/cli.js:154:9 node:child_process:903 throw err; ^

Error: Command failed: …/…/node_modules/.bin/electron-rebuild --parallel --force --types prod,dev,optional --module-dir . at checkExecSyncError (node:child_process:826:11) at execSync (node:child_process:900:15) at Object. (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/.erb/scripts/electron-rebuild.js:17:3) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Module._compile (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/pirates/lib/index.js:99:24) macbookpro@MacbookPros-MBP app % yarn yarn install v1.22.10 [1/4] 🔍 Resolving packages… success Already up-to-date. $ yarn electron-rebuild && yarn link-modules yarn run v1.22.10 $ node -r …/…/.erb/scripts/babel-register.js …/…/.erb/scripts/electron-rebuild.js ⠇ Building modules: 0/2 CC(target) Release/obj.target/bufferutil/src/bufferutil.o CC(target) Release/obj.target/bufferutil/src/bufferutil.o ⠹ Building modules: 0/2error: /Library/Developer/CommandLineTools/usr/bin/lipo: can’t move temporary file: Release/obj.target/bufferutil/src/bufferutil.o to file: Release/obj.target/bufferutil/src/bufferutil.o.lipo (No such file or directory) clang: error: lipo command failed with exit code 1 (use -v to see invocation) make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1 ✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild node-gyp failed to rebuild ‘/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/build/app/node_modules/bufferutil’. For more information, rerun with the DEBUG environment variable set to “electron-rebuild”.

Error: make failed with exit code: 2

Error: node-gyp failed to rebuild ‘/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/build/app/node_modules/bufferutil’. For more information, rerun with the DEBUG environment variable set to “electron-rebuild”.

Error: make failed with exit code: 2

at NodeGyp.rebuildModule (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/electron-rebuild/lib/src/module-type/node-gyp.js:109:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ModuleRebuilder.rebuildNodeGypModule (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/electron-rebuild/lib/src/module-rebuilder.js:94:9) at async Rebuilder.rebuildModuleAt (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/electron-rebuild/lib/src/rebuild.js:226:9) at async Promise.all (index 91) at async Rebuilder.rebuild (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/electron-rebuild/lib/src/rebuild.js:180:13) at async /Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/electron-rebuild/lib/src/cli.js:154:9 node:child_process:903 throw err; ^

Error: Command failed: …/…/node_modules/.bin/electron-rebuild --parallel --force --types prod,dev,optional --module-dir . at checkExecSyncError (node:child_process:826:11) at execSync (node:child_process:900:15) at Object. (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/.erb/scripts/electron-rebuild.js:17:3) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Module._compile (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/pirates/lib/index.js:99:24) at Module._extensions…js (node:internal/modules/cjs/loader:1153:10) at Object.newLoader [as .js] (/Users/macbookpro/Documents/Audio-Sundae/sundae/sundae-desktop/node_modules/pirates/lib/index.js:104:7) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) { status: 255, signal: null, output: [ null, null, null ], pid: 39612, stdout: null, stderr: null } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. SOLINK_MODULE(target) Release/bufferutil.node error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. macbookpro@MacbookPros-MBP app % clang: error: no such file or directory: ‘Release/obj.target/bufferutil/src/bufferutil.o’ make: *** [Release/bufferutil.node] Error 1

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
w3b6x9commented, Sep 26, 2022

@lmick002 were you able to find a workaround / get this working?

0reactions
ComputerDencommented, Nov 18, 2022

anyone further forward with this? currently just uninstall and reinsatlling it where its needed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to build app using electron-builder. Error: gyp failed ...
u need to install python 2.7.x then add to ur PATH environment. remove node_modules and package-lock.json then run npm install again.
Read more >
electron-rebuild - npm
Electron supporting package to rebuild native node modules against the currently installed electron. Latest version: 3.2.9, last published: ...
Read more >
electron-rebuild - npm Package Health Analysis - Snyk
Electron supporting package to rebuild native node modules against the currently installed electron For more information about how to use this package see ......
Read more >
Using Native Node Modules · GitBook
Installing modules and rebuilding for Electron. You can also choose to install modules like other Node projects, and then rebuild the modules for...
Read more >
A Comprehensive Guide to Fixing Node-Gyp Issues on Windows
It has widespread use and is included as a dependency in many NPM packages. On most systems, this isn't an issue, and installing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found