Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to run (cannot find module 'electron') #33

Closed
jimjam-slam opened this issue Mar 24, 2017 · 11 comments
Closed

Fails to run (cannot find module 'electron') #33

jimjam-slam opened this issue Mar 24, 2017 · 11 comments

Comments

@jimjam-slam
Copy link

jimjam-slam commented Mar 24, 2017

🤷🏽‍♂️ Current Behaviour

pb-for-desktop installs fine from NPM (it looks like version 4.1.0 on there), but it crashes when I run it:

$ pb-for-desktop
module.js:440
    throw err;
    ^

Error: Cannot find module 'electron'
    at Function.Module._resolveFilename (module.js:438:15)
    at Function.Module._load (module.js:386:25)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/pb-for-desktop/bin/cli.js:21:18)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)

🎯 Expected Behaviour

Expected PB for Desktop to open a window, a menu icon and a dock icon.

👟 Steps to Reproduce (S2R)

  1. Install pb-for-desktop via NPM: npm install --verbose -g pb-for-desktop
  2. Run pb-for-desktop

🏡 Environmental Context

App Version
v4.1.0
Installation Type
Setup
Operating System
macOS: 10.12.3
Node
v6.1.0
NPM
v4.4.4

@sidneys
Copy link
Owner

sidneys commented Mar 31, 2017

@Rensa
This should be fixed as of v4.7.5 - please post your findings.

@sidneys
Copy link
Owner

sidneys commented Apr 1, 2017

@Rensa

Module version v4.9.1 with a bootstrapping system should alleviate this issue, please review using these commands:

npm --global install pb-for-desktop
DEBUG=1 pb-for-desktop

@jimjam-slam
Copy link
Author

@sidneys After npm uninstall and npm installing again I still get:

$ DEBUG=1 pb-for-desktop
module.js:440
    throw err;
    ^

Error: Cannot find module '/usr/local/lib/package.json'
    at Function.Module._resolveFilename (module.js:438:15)
    at Function.Module._load (module.js:386:25)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/pb-for-desktop/bin/cli.js:29:21)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)

The installation output indicates that NPM is installing v4.9.1.

@sidneys
Copy link
Owner

sidneys commented Apr 6, 2017

@Rensa

Thanks. Another fix has been implemented, please retest with v5.0.6 or later.

@sidneys
Copy link
Owner

sidneys commented Apr 6, 2017

@Rensa 5.1.1 has been deployed to npm.

@sidneys
Copy link
Owner

sidneys commented Apr 8, 2017

@Rensa reply needed here.

@jimjam-slam
Copy link
Author

Sorry for the delay, @sidneys. Got an error further along running v5.1.1:

$ pb-for-desktop
ℹ️ [PB for Desktop] installing dependencies: "electron@1.6.5", "electron-builder@16.7.0", "electron-connect@0.6.1", "electron-prebuilt-compile@git://github.com/sidneys/electron-prebuilt-compile.git#deploy", "fkill@4.1.0", "git-branch@0.3.0", "gulp@3.9.1", "gulp-load-plugins@1.5.0", "hash-files@1.1.1", "is-ci@1.0.10", "json2md@1.5.8", "progress@2.0.0", "publish-release@1.3.3", "yamljs@0.2.9" 
child_process.js:513
    throw err;
    ^

Error: Command failed: npm install electron@1.6.5 electron-builder@16.7.0 electron-connect@0.6.1 electron-prebuilt-compile@git://github.com/sidneys/electron-prebuilt-compile.git#deploy fkill@4.1.0 git-branch@0.3.0 gulp@3.9.1 gulp-load-plugins@1.5.0 hash-files@1.1.1 is-ci@1.0.10 json2md@1.5.8 progress@2.0.0 publish-release@1.3.3 yamljs@0.2.9 --loglevel silent
    at checkExecSyncError (child_process.js:470:13)
    at Object.execSync (child_process.js:510:13)
    at installDependencies (/usr/local/lib/node_modules/pb-for-desktop/bin/cli.js:86:23)
    at main (/usr/local/lib/node_modules/pb-for-desktop/bin/cli.js:140:5)
    at Object.<anonymous> (/usr/local/lib/node_modules/pb-for-desktop/bin/cli.js:159:5)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)

@sidneys
Copy link
Owner

sidneys commented Apr 10, 2017

@Rensa
Thanks. The problem has to do with your type of npm/node installation, which has not been carried out using the recommended approach (using nvm) and therefore creates global node_modules in awkward places (such as /usr/local/lib/node_modules).

What happens if you try this:

$ DEBUG=* pb-for-desktop

@sidneys
Copy link
Owner

sidneys commented Apr 14, 2017

@Rensa

Reply needed here, closing otherwise.

@jimjam-slam
Copy link
Author

@sidneys, Sorry, I don't have great Internet access now. I'm happy to close if you think this is down to my node installation.

@sidneys
Copy link
Owner

sidneys commented Apr 16, 2017

@Rensa Okay. I recommend installing nvm though anyway, it's the most uncomplicated way to run node and global node modules (without sudo) :-)

@sidneys sidneys closed this as completed Apr 16, 2017
@sidneys sidneys removed their assignment Aug 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants