]> khamidou — GitHub mirrors - electron.git/commitdiff
docs: Add "require('electron').xxx is undefined." to FAQ
authorCheng Zhao <zcbenz@gmail.com>
Mon, 25 Jan 2016 10:41:34 +0000 (18:41 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 25 Jan 2016 10:47:46 +0000 (18:47 +0800)
docs/faq/electron-faq.md

index e8f5b191d7a65b0d7978db6851ea5e74252ba01e..3e141535af01faebdbac1ac401ee705eae87f372 100644 (file)
@@ -79,5 +79,18 @@ delete window.module;
 </head>
 ```
 
+## `require('electron').xxx` is undefined.
+
+When using Electron's built-in module you might encounter an error like this:
+
+```
+> require('electron').webFrame.setZoomFactor(1.0);
+Uncaught TypeError: Cannot read property 'setZoomLevel' of undefined
+```
+
+This is because you have the npm `electron` module installed either locally or
+globally, which overrides Electron's built-in module. You can to either remove
+the module, or rename it.
+
 [memory-management]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management
 [variable-scope]: https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx