Comments (15)
I had a similar problem on OSX (same error, different executable of course).
OSX 10.10.5 / OSX 10.11.1
Node.js 5.0.0 / 5.1.0
Worked around it by changing node_modules/electron-rebuild/lib/spawn.js
Around line 25, there is this code:
return new _Promise(function (resolve, reject) {
var error = null;
//console.log("Calling spawn! " + JSON.stringify(options));
var proc = _child_process2['default'].spawn(options.cmd, options.args, options.opts);
Changed it to provide the cwd
(current working directory) to the spawn command
return new _Promise(function (resolve, reject) {
var error = null;
if (!('cwd' in options.opts)) {
options.opts.cwd = process.cwd() + '/node_modules/electron-prebuilt';
}
//console.log("Calling spawn! " + JSON.stringify(options));
var proc = _child_process2['default'].spawn(options.cmd, options.args, options.opts);
I'm sure this isn't the way to go (as the paths on various OS's will differ), hence I haven't made a pull request.
from rebuild.
@rspieker - thank you for your advice - for me your fix is working 👍
from rebuild.
switch to npm 2 can temporary solution to the problem
from rebuild.
Had the same problem on OSX and tried rspieker's change. Now getting:
Cannot find module 'npm/node_modules/node-gyp/bin/node-gyp'
Error: Cannot find module 'npm/node_modules/node-gyp/bin/node-gyp'
at Function.Module._resolveFilename (module.js:338:15)
at Function.require.resolve (module.js:389:19)
at installNodeHeaders$ (/Users/steve/Desktop/electron/node_modules/electron-rebuild/lib/main.js:166:25)
at tryCatch (/Users/steve/Desktop/electron/node_modules/babel-runtime/regenerator/runtime.js:72:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
at tryCatch (/Users/steve/Desktop/electron/node_modules/babel-runtime/regenerator/runtime.js:72:40)
at invoke (/Users/steve/Desktop/electron/node_modules/babel-runtime/regenerator/runtime.js:146:20)
at /Users/steve/Desktop/electron/node_modules/babel-runtime/regenerator/runtime.js:156:13
at run (/Users/steve/Desktop/electron/node_modules/core-js/library/modules/es6.promise.js:104:47)
with node v5.1.1 and npm 3.3.12. Tired installing node-gyp without luck.
from rebuild.
I am having the same issue as @stevedekorte. Installing node-gyp also did not fix the issue for me.
from rebuild.
BTW, I realized that only 15 lines of code is required to build native modules — https://github.com/develar/onshape-desktop-shell/blob/master/build/util.js#L12-L27
from rebuild.
I was able to resolve my problem by doing a complete removal and re-install of node/npm.
from rebuild.
@stevedekorte What steps did you take to remove and reinstall? Did you reinstall node 5.3? I have uninstalled/reinstalled using brew and nvm and am still getting the same error as above.
from rebuild.
Sometimes, electron_prebuilt is not installed correctly and the path.txt file is not updated correctly fix the full absolute path but with the relative path.
A quick fix is to either clean npm cache and reinstall electron-prebuilt or to update path.txt with the absolute path.
The normal fix is to makes electron-rebuild works also with relative path. I made a pull request
from rebuild.
Reinstalling electron_prebuilt, clearing the npm cache, and setting the absolute path in path.txt fixed the issue for me, thanks for the help!
from rebuild.
Thank you @rspieker. Worked for me too
from rebuild.
No combination of reinstalling, clearing npm's cache, or editing the path.txt file work for me.
MacOS 10.11.3
npm 2.14.12
node 4.2.6
electron-prebuilt 0.36.4
My path.txt file contains:
dist/Electron.app/Contents/MacOS/Electron
I've tried modifying that to an absolute path:
/Users/tom/projects/xde/node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron
And to a project-relative path:
./node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron
But electron-prebuilt throws a fatal error at startup unless I use the original path. Here's the error:
{ [Error: Command failed: /bin/sh -c npm start
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn /Users/tom/projects/xde/node_modules/electron-prebuilt/node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron ENOENT
at exports._errnoException (util.js:870:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:441:9)
at process._tickCallback (node.js:355:17)
at Function.Module.runMain (module.js:444:11)
at startup (node.js:136:18)
at node.js:966:3
from rebuild.
You might want to make sure you wipe any bash or shell path references to node/npm as well.
from rebuild.
@tomprogers I don't think this is a bug related to electron-rebuild
from rebuild.
But electron-prebuilt throws a fatal error at startup unless I use the original path
Why don't you use the original path ?
from rebuild.
Related Issues (20)
- Error related to `.forge-meta` file HOT 1
- GCC_PREFIX_HEADER & GCC_PRECOMPILE_PREFIX_HEADER incompatible with Electron 20
- error rebuild canvas on Windows HOT 3
- Rebuilding node-canvas with electron-rebuild fails HOT 4
- Could not detect abi for version 22.3.3 and runtime electron. Updating "node-abi" might help solve this issue if it is a new release of electron at getAbi HOT 8
- no file node_modules/.bin/electron-rebuild in 3.2.11 HOT 1
- Error when rebuilding node-java package HOT 1
- Python 2 died 1,259 days ago on 1/1/2020. Why still use it? HOT 1
- Cross Compile on Linux
- Help using rebuild to package node-sqlite3 to use with Electron HOT 2
- ERR_REQUIRE_ESM HOT 1
- Follow OS conventions for storing cache
- it is not rebuilding for electron from the package root HOT 2
- need to upgrade node-gyp HOT 6
- Complains for deprecated move-file
- @electron/rebuild ignores symlinks for native modules, which crashes the application HOT 1
- Module build fails with empty binding.gyp HOT 3
- Windows CI Failing
- Not rebuilding with --which-module argument
- Pass arch armv7l as "arm" to node-gyp
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rebuild.