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

'"Cannot read property 'getPath' of undefined" when trying to install extensions #30

Closed
wangpin34 opened this issue Dec 9, 2016 · 2 comments

Comments

@wangpin34
Copy link

Today I meet an error when I tried to install REDUX_DEVTOOLS at my windows pc.

  • My install script
    installTools.js
const installExtension = require('electron-devtools-installer');
const REDUX_DEVTOOLS = installExtension.REDUX_DEVTOOLS;

installExtension(REDUX_DEVTOOLS)
    .then((name) => console.log(`Added Extension:  ${name}`))
    .catch((err) => console.log('An error occurred: ', err));
  • Error log
> electron-quick-start@1.0.0 init-dev C:\workspace\electron-quick-start
> node --harmony installTools.js

C:\workspace\electron-quick-start\node_modules\electron-devtools-installer\dist\       utils.js:23
  var savePath = (_electron.remote || _electron2.default).app.getPath('userData'       );
                                                             ^

TypeError: Cannot read property 'getPath' of undefined
    at getPath (C:\workspace\electron-quick-start\node_modules\electron-devtools       -installer\dist\utils.js:23:62)
    at Object.<anonymous> (C:\workspace\electron-quick-start\node_modules\electr       on-devtools-installer\dist\index.js:42:59)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\workspace\electron-quick-start\installTools.js:1:8       8)

I can not understand why the property app is undefined here. Is there any one who meet this error too?

PS. My env

  • electron-devtools-installer 2.0.1
  • nodejs v6.9.2
  • npm 4.0.5
  • OS win10
@MarshallOfSound
Copy link
Owner

It happens when you either

a) have a bad node_modules install
b) are using a dodgy terminal (normally embedded in an IDE)

Fix either of the above two things and everything will magically work 👍

@alex028502
Copy link

Hi Marshall, I've got the same issue in my project, so I have reproduced it in a minimal repository. I using ubuntu 18 with node 10.4.

nvm use 10
git clone https://github.com/alex028502/electron-devtools-installer-issue-30.git
cd electron-devtools-installer-issue-30
npm install
npm start

I am getting the exact same error in my actual project.

.../electron-devtools-installer-issue-30/node_modules/electron-devtools-installer/dist/utils.js:27
  var savePath = (_electron.remote || _electron2.default).app.getPath('userData')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants