Code Monkey home page Code Monkey logo

Comments (15)

rspieker avatar rspieker commented on August 21, 2024 2

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.

dziudek avatar dziudek commented on August 21, 2024

@rspieker - thank you for your advice - for me your fix is working 👍

from rebuild.

builden avatar builden commented on August 21, 2024

switch to npm 2 can temporary solution to the problem

from rebuild.

stevedekorte avatar stevedekorte commented on August 21, 2024

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.

cbrewster avatar cbrewster commented on August 21, 2024

I am having the same issue as @stevedekorte. Installing node-gyp also did not fix the issue for me.

from rebuild.

develar avatar develar commented on August 21, 2024

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.

stevedekorte avatar stevedekorte commented on August 21, 2024

I was able to resolve my problem by doing a complete removal and re-install of node/npm.

from rebuild.

jg123 avatar jg123 commented on August 21, 2024

@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.

felicienfrancois avatar felicienfrancois commented on August 21, 2024

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.

cbrewster avatar cbrewster commented on August 21, 2024

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.

aggregatejeff avatar aggregatejeff commented on August 21, 2024

Thank you @rspieker. Worked for me too

from rebuild.

tomprogers avatar tomprogers commented on August 21, 2024

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.

stevedekorte avatar stevedekorte commented on August 21, 2024

You might want to make sure you wipe any bash or shell path references to node/npm as well.

from rebuild.

anaisbetts avatar anaisbetts commented on August 21, 2024

@tomprogers I don't think this is a bug related to electron-rebuild

from rebuild.

felicienfrancois avatar felicienfrancois commented on August 21, 2024

@tomprogers

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.