electron-sudo
electron-sudo copied to clipboard
Cannot find module `regenerator-runtime`
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?~~
Nevermind, it was my fault, I had some dead code that was settings global.window
to null
.
However, on fresh installs, regenerator-runtime
isn't depended upon, so that's still an issue.
@facekapow regenerator-runtime
is a devDependency
, from package babel-plugin-transform-regenerator
, it's added in appropriate package.json
section
It's required at runtime, it should be a regular dependency; npm
doesn't install devDependencies
when you do npm install <pkg>
.
@facekapow regenerator-runtime
not correctly packed with webpack
, need to investigate it
@facekapow https://github.com/automation-stack/electron-sudo/commit/24544fee74e5eb9c97495d6ff81aad5910356ac3
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();
@littletinman did you run npm i
in your project directory? babel-runtime
now is bundled as dependency
@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.
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.
$ rm -rf /node_modules .package-lock.json
$ npm install
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