Nw.js: Developer Tools wasn't opend when I press F12

Created on 19 Jul 2016  路  5Comments  路  Source: nwjs/nw.js

I have Ubuntu Desktop 14.04.4 LTS and nw.js this: http://dl.nwjs.io/v0.16.0-rc1/nwjs-v0.16.0-rc1-linux-x64.tar.gz

I tried to press F12 button but it doesn't work, then I tried with code snippet:

var win = nw.Window.get();
win.showDevTools('', function (item) {
     console.log(item);
});

and this:

require('nw.gui').Window.get().showDevTools();

with code snippet it opens new window but its blank (white screen) :/ then I tried to appear toolbar, in package.json I insert this code:

"window": {
      "toolbar": true
  }

but it doesn't work.

I uploaded my project, into the folder you can run npm start and it will deploy...
https://mega.nz/#!1BA2HLSC

I seen terminal and there is some errors (maybe):

/usr/share/themes/MBuntu-Y-For-Unity/gtk-2.0/widgets/panel.rc:18: Unable to locate image file in pixmap_path: "images/panel/panel-normal.svg"
/usr/share/themes/MBuntu-Y-For-Unity/gtk-2.0/widgets/panel.rc:21: Background image options specified without filename
/usr/share/themes/MBuntu-Y-For-Unity/gtk-2.0/widgets/panel.rc:27: Unable to locate image file in pixmap_path: "images/panel/panel-active.svg"
/usr/share/themes/MBuntu-Y-For-Unity/gtk-2.0/widgets/panel.rc:30: Background image options specified without filename
/usr/share/themes/MBuntu-Y-For-Unity/gtk-2.0/widgets/panel.rc:61: error: invalid string constant "button", expected valid string constant
[883:883:0719/093014:ERROR:CONSOLE(1)] "Uncaught ReferenceError: DevToolsAPI is not defined", source:  (1)
[883:883:0719/093014:ERROR:CONSOLE(1)] "Uncaught ReferenceError: DevToolsAPI is not defined", source:  (1)

Most helpful comment

Update: It turns out maybe I wasn't using the SDK version that I downloaded that I thought I was using after all.

I'd tried installing a few different ways, including adding the nw package to my package.json (yarn add --dev nw). I'm guessing it must have been using the version of nw from that npm package instead of my globally installed nw in /usr/bin.

Solution was apparently to read down further on https://www.npmjs.com/package/nw where it explains how to get it to use the SDK version... For example, with

npm install nw --nwjs_build_type=sdk

or (the way I ended up using/preferring), adding -sdk to the package name:

yarn add --dev [email protected]

I am now able to open dev tools in my nw app. :+1:

All 5 comments

You should use SDK build. devtools in available only in SDK build.

where is SDK build?

@vatex There's are different downloads for SDK and "Normal" on https://nwjs.io/.

Did you ever get this working? I'm having the same issue (a year later)... :disappointed:

Even though I downloaded the v0.23.6 SDK version like @rogerwang suggested, I get this same error when trying to win.showDevTools() programmatically:

[7797:7797:0718/150644.051485:ERROR:CONSOLE(1)] "Uncaught ReferenceError: DevToolsAPI is not defined", source:  (1)

and pressing F12 in the window doesn't have any effect.

nw --version shows:

[0718/151607.420419:WARNING:chrome_main_delegate.cc(569)] final extension: 
nwjs 59.0.3071.115 

By the way, this is the first link that shows up when you Google for "Uncaught ReferenceError: DevToolsAPI is not defined" ubuntu

Update: It turns out maybe I wasn't using the SDK version that I downloaded that I thought I was using after all.

I'd tried installing a few different ways, including adding the nw package to my package.json (yarn add --dev nw). I'm guessing it must have been using the version of nw from that npm package instead of my globally installed nw in /usr/bin.

Solution was apparently to read down further on https://www.npmjs.com/package/nw where it explains how to get it to use the SDK version... For example, with

npm install nw --nwjs_build_type=sdk

or (the way I ended up using/preferring), adding -sdk to the package name:

yarn add --dev [email protected]

I am now able to open dev tools in my nw app. :+1:

Was this page helpful?
0 / 5 - 0 ratings