Node modules not loading, "require" function not working
The following code works with nwjs-v0.12.3-win-x64 but it does not work in nwjs-v0.13.0-alpha2-win-x64 on my computer. I am currently using NodeJS v0.12.7.
<html> <body> <script> // get the system platform using node.js var os = require('os') document.write('Our computer is: ', os.platform()) </script> </body> </html>
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
nwjs v0.13.0 is reworking some things to take advantage of / better fit with newer chromium/v8 versions. Some of the global variables that were always "just there" in nw.js 0.12 are now contained within the global variable 'nw'. Using 'nw.require' should work.
Please check some of the other times people have asked the same question, such as:#3837 #3765 and look at the mail group postings. nw.js v0.13.0 is the experimental in-progress alpha wow-some-things-work with new v8/Chromium version. :smile:
RE: "Please check some of the other times people have asked the same question"
I did try to search for it but there was no error message or exception. The code snippet worked in one release but not the other. My searches did not show any results you cited. And here I thought I was being a good ciitizen by pointing out an issue.
The following code DOES work with nwjs-v0.13.0-alpha2-win-x64 on my computer:
<html> <body> <script> // get the system platform using node.js var os = nw.require('os') document.write('Our computer is: ', os.platform()) </script> </body> </html>
The doc on the following page should probably be updated to show this change: https://github.com/nwjs/nw.js
@dperu Missing old questions/issues happens. I just found where a report I generated last week against Chrome actually had 9 (!) duplicates across a year and a half time. I just don't know how I missed seeing _all_ of them.... :/
The following codes work fine for me on nwjs-sdk-v0.24.4.
<html>
<body>
<script>
// get the system platform using node.js
var os = require('os')
document.write('Our computer is: ', os.platform())
</script>
</body>
</html>
close until there is more information.
Hi does this thing work in browser?
like i wanted to use this in reactjs web application. will it work