3
votes

I am using https://github.com/mllrsohn/grunt-node-webkit-builder to package my node-webkit app which is built using AngularJS.

The app works fine on MAC when I build from Sublime Text. But when I package the app using any packaging tool, I get the error saying "require is not defined". What am I missing?

For more context, I have a services layer which is written in Node.js using express. The Angular project calls Node.js APIs and renders the content. I am using a SQLite3 DB. Which is the best way to package such apps? I am alright with writing an installer starts Node.js server separately.

1
A code example would be helpful, so we can see exactly how your currently approaching this. - Tyson Phalp
I'm dealing with this now as well and I suspect it's a path length issue because I can't copy my app due to the deep recursion in node-modules and the 260 character limit in the path. I think that when it unpacks to run, it's not unpacking cleanly. I'm trying to find a way to test this definitively, but it's largely intuition as I've successfully deployed more simple apps using grunt-node-webkit-builder on windows. - rainabba

1 Answers

2
votes

You'll always get a "require is not defined" error if you don't use a node-webkit environement for developpement in Windows. You can use nodebob for developpement environement : You have to put your html files into nodebob\buildTools\nw and then run nw.exe Just reload it after your changes