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 find module regenerator-runtime #33

Open
facekapow opened this issue Nov 4, 2016 · 12 comments
Open

Cannot find module regenerator-runtime #33

facekapow opened this issue Nov 4, 2016 · 12 comments

Comments

@facekapow
Copy link
Contributor

facekapow commented Nov 4, 2016

When trying to run an Electron app that uses this, it complains about not being able to find regenerator-runtime. Inspecting the code of dist/index.js reveals that this is true, regenerator-runtime is required but not depended upon.

Ok, that's fine, I just installed regenerator-runtime manually. Except, now it's throwing because it can't read Math from null. Once again, inspecting dist/index.js shows that it's trying to get Math from a window global. I'm trying to use electron-sudo in the main process, is this it only supposed to be used in the renderer process?

@facekapow
Copy link
Contributor Author

Nevermind, it was my fault, I had some dead code that was settings global.window to null.

@facekapow facekapow changed the title Cannot find module regenerator-runtime & Cannot read property 'Math' of null Cannot find module regenerator-runtime Nov 4, 2016
@facekapow
Copy link
Contributor Author

facekapow commented Nov 4, 2016

However, on fresh installs, regenerator-runtime isn't depended upon, so that's still an issue.

@facekapow facekapow reopened this Nov 4, 2016
@automation-stack
Copy link
Owner

@facekapow regenerator-runtime is a devDependency, from package babel-plugin-transform-regenerator, it's added in appropriate package.json section

@facekapow
Copy link
Contributor Author

It's required at runtime, it should be a regular dependency; npm doesn't install devDependencies when you do npm install <pkg>.

@automation-stack
Copy link
Owner

@facekapow regenerator-runtime not correctly packed with webpack, need to investigate it

@automation-stack
Copy link
Owner

@facekapow 24544fe

@littletinman
Copy link

I'm having this issue using Vanilla Javascript implementation.

Version: 4.0.12
Electron Version: 1.6.11

var Sudoer = require('electron-sudo').default;
var sudoer = new Sudoer();

@automation-stack
Copy link
Owner

@littletinman did you run npm i in your project directory? babel-runtime now is bundled as dependency

@littletinman
Copy link

@automation-stack I ran npm i but nothing was shown, I ended up just running npm install regenerator-runtime --save and that solved the problem.

@wle8300
Copy link

wle8300 commented Aug 21, 2017

I had this problem. I'm using a Mac so I had to open another tab in Terminal.app. You can just restart Terminal to be doubly sure.

@luscas
Copy link

luscas commented Feb 2, 2019

$ rm -rf /node_modules .package-lock.json
$ npm install

@gs3bopar
Copy link

When using npm install --save-dev @babel/plugin-transform-runtime, you need to have npm install --save @babel/runtime as a production dependency.

If this doesn't work for you try clearing the npm cache and then do npm install. See if that fixes your problem.

For more information look here: https://babeljs.io/docs/en/babel-plugin-transform-runtime

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

6 participants