1
votes

I've created an Angularjs app by cloning the angular-seed.

git clone --depth=1 https://github.com/angular/angular-seed.git Web
cd Web
npm install

Then the app can be started by running npm start.

I tried to create a new project and selected template "Javascript -> Node.js -> From Existing Node.js code". Then I set the start js file to Web/app.app.js. However, running (debug) the app got the following error?

Debugger listening on [::]:5858
 D:\....Web\app\app.js:4
angular.module('myApp', [
^

ReferenceError: angular is not defined
    at Object. (D:\....\Web\app\app.js:4:1)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Timeout.Module.runMain [as _onTimeout] (module.js:590:10)
    at tryOnTimeout (timers.js:232:11)
    at Timer.listOnTimeout (timers.js:202:5)
 Press any key to continue...

Update: I need to deploy the angular app on nodejs. How to create an angular project run on node?

2

2 Answers

2
votes

I think your getting confused as Angular will not run directly with node. Just open Visual Studio then select File -> Open -> Website.. then browse to and select your /Web folder.

Once web site is open just make sure app/index.html is selected hit F5. It may ask you to alter web.config to enable debugging - or just if you just want to view it you can right click on index.html and View in browser.

0
votes

If angular is not defined then the AngularJS script has not loaded.