require is not defined on nwjs-v0.13.0-alpha3

1,560 views
Skip to first unread message

jtg-gg

unread,
Jul 31, 2015, 12:52:15 AM7/31/15
to nw.js
I've 'require is not defined' on my java-script when running it on nwjs-v0.13.0-alpha3
anybody know how to fix it ?

this is what I'm trying to do
var gui = require('nw.gui');

Pedro Lucas da Silva Junior

unread,
Jul 31, 2015, 10:28:14 AM7/31/15
to jtg-gg, nw.js
Try: global.window.require('nw.gui');

--
You received this message because you are subscribed to the Google Groups "nw.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nwjs-general...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roger Wang

unread,
Jul 31, 2015, 7:20:50 PM7/31/15
to nw.js
It's now 'nw.require' -- the node symbols have been put under the 'nw' object.

Roger
Message has been deleted
Message has been deleted

Pedro Lucas da Silva Junior

unread,
Aug 3, 2015, 11:38:15 AM8/3/15
to jtg-gg, nw.js, wen...@gmail.com
The best way to use menu for now is using v 0.12.3.

Roger, how can I get Menu object in v0.13.0?

Pedro

2015-08-03 6:14 GMT-03:00 'jtg-gg' via nw.js <nwjs-g...@googlegroups.com>:

Roger, Pedro

I still can't make it works 😞

nw object is not available, only Window object available, but it doesn't have 'require' function


Jefry

On Saturday, August 1, 2015 at 6:41:43 PM UTC+7, michael.picovschi wrote:
That's is good to know :) so no more conflicts with require.js I guess !

--
You received this message because you are subscribed to the Google Groups "nw.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nwjs-general...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Michaël Picovschi, Morphiks

Roger Wang

unread,
Aug 3, 2015, 9:33:22 PM8/3/15
to nw.js, wen...@gmail.com
It works for me. Can you provide a sample?

btw, are you using 'node-remote'? It's not fully migrated yet.

Roger


On Monday, August 3, 2015 at 5:14:08 PM UTC+8, jtg-gg wrote:

Roger, Pedro

I still can't make it works 😞

nw object is not available, only Window object available, but it doesn't have 'require' function


Jefry

On Saturday, August 1, 2015 at 6:41:43 PM UTC+7, michael.picovschi wrote:
That's is good to know :) so no more conflicts with require.js I guess !
2015-08-01 1:20 GMT+02:00 Roger Wang <wen...@gmail.com>:

--
You received this message because you are subscribed to the Google Groups "nw.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nwjs-general...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roger Wang

unread,
Aug 3, 2015, 9:35:40 PM8/3/15
to nw.js, wen...@gmail.com
Oops. Didn't see the image.

'nw.gui' module is not there. The migrated API is now under the 'nw' object directly: nw.App, nw.Window etc.

I'm thinking to provide a wrapper 'nw.gui' module for full backward compatibility.

Roger

On Monday, August 3, 2015 at 5:14:08 PM UTC+8, jtg-gg wrote:

Roger, Pedro

I still can't make it works 😞

nw object is not available, only Window object available, but it doesn't have 'require' function


Jefry

On Saturday, August 1, 2015 at 6:41:43 PM UTC+7, michael.picovschi wrote:
That's is good to know :) so no more conflicts with require.js I guess !
2015-08-01 1:20 GMT+02:00 Roger Wang <wen...@gmail.com>:

--
You received this message because you are subscribed to the Google Groups "nw.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nwjs-general...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

matthew...@gmail.com

unread,
Aug 4, 2015, 7:24:05 PM8/4/15
to nw.js
Would it be possible to only trigger "nw.require" when explicitly setting a "noconflict: true" tag in the package.json file? That way existing projects would work as is without rewriting?

owen.wi...@gmail.com

unread,
Nov 9, 2015, 11:27:55 PM11/9/15
to nw.js, wen...@gmail.com
Hi Roger - how to access nw.gui?

Currently I'm trying:

  console.log(nw.Gui); // doesn't work - going off you nw.App, nw.Window example?
 
var gui = nw.require('nw.gui'); // Cannot find module nw.gui
  console
.log(gui);

Can't seem to access this? Any ideas

Roger Wang

unread,
Nov 10, 2015, 12:11:08 AM11/10/15
to nw.js, wen...@gmail.com, owen.wi...@gmail.com
It's nw.Window, nw.App, etc for now due to the architecture change in nw13. In beta phase we'll provide a wrapper library to simulate nw.gui.

Thanks,

Roger

ham...@gmail.com

unread,
Nov 10, 2015, 11:27:10 PM11/10/15
to nw.js, wen...@gmail.com, owen.wi...@gmail.com
Uncaught ReferenceError: nw is not defined
when i use var win = nw.Window;

tiitr...@gmail.com

unread,
Nov 20, 2015, 3:23:45 AM11/20/15
to nw.js, wen...@gmail.com
Any plans to full migration for 'node-remote'?

Tiit

sergiy...@gmail.com

unread,
Jan 21, 2016, 10:00:09 AM1/21/16
to nw.js, wen...@gmail.com, tiitr...@gmail.com
trying to use this
"Getting started"


http://docs.nwjs.io/en/latest/For%20Users/Getting%20Started/

Example 2 - Using NW.js APIs

..


'Right click' to show context menu.   -- getting nothing

when i open "console" i see red   Uncaught ReferenceError: nw is not defined



Message has been deleted

Sig ma

unread,
Feb 19, 2016, 3:09:03 AM2/19/16
to nw.js, wen...@gmail.com, tiitr...@gmail.com, sergiy...@gmail.com
plz see this issue:

https://github.com/nwjs/nw.js/issues/4276

在 2016年1月21日星期四 UTC+8下午11:00:09,sergiy...@gmail.com写道:
Reply all
Reply to author
Forward
0 new messages