Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have been building and debugging an Angular.JS application for several months now running from a browser without any issues whatsoever, however I am now in the stages of packaging it to run in node wrapper. When i created my package.json and ran the folder from nw.exe I get an error that says:

Uncaught node.js Error 

    ReferenceError: angular is not defined
        at file:///C:/wamp/www/Maintenence/ng/ng-init.js:2:11

now the code line it has a problem with in ng-init.js is

var app = angular.module('MaintenenceApp', ['ngRoute']);

It doesnt like angular in angular.module and once I received this error I went to the angular.js docs to make sure i hadnt done something wrong here and according to https://docs.angularjs.org/guide/module this code is 100% correct.

what could be causing this error. as i mentioned, it runs perfectly in a web browser with no errors in js console.

package.json

{
    "main": "index.html", 
    "name": "Maintenence Manager", 
    "version": "0.0.1", 
    "window": {
        "toolbar": false,
        "frame"  : true
    }
}

here is the order of my scripts in the head of index.html index.html

<didnt seem important to show css links and such but jquery is also in the page>
<script type="text/javascript" src="//code.angularjs.org/1.3.0-rc.0/angular.js"></script>
<Script type="text/javascript" src="//code.angularjs.org/1.3.0-rc.0/angular-route.js"></Script>
<script type="text/javascript" src="ng/ng-init.js"></script>

Thanks in advance.

share|improve this question

1 Answer 1

As it turns out, Node Webkit doesn't support src="//url.com" which i use so the http/https thing doesn't become in issue.

Replacing the urls for the scripts with src="http://url.com" fixed my issue.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.