Ich bin komplett neu in AngularJS und ich habe vielleicht einen entscheidenden, aber nicht offensichtlichen Schritt auf dem Weg zum Starten eines neuen AngularJS-Projekts in WebStorm verpasst.ReferenceError: eckig ist in WebStorm nicht definiert
Ich installierte Node.JS, installierte Angular mit Npm, ich installierte sogar Laube, ich installierte sogar Winkel in Laube, aber an diesem Punkt bin ich nicht sicher, was ich vermisse.
auf Debug, erhalte ich die folgende Meldung:
c:\Users\YourUser\WebstormProjects\angularjs-template\app\app.js:6
angular.module('myApp', [
^
ReferenceError: angular is not defined
at Object.<anonymous> (c:\Users\YourUser\WebstormProjects\angularjs-template\app\app.js:6:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain [as _onTimeout] (module.js:497:10)
at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)
Auf Run, erhalte ich die folgende Meldung:
c:\Users\YourUser\WebstormProjects\angularjs-template\app\app.js:6
angular.module('myApp', [
^
ReferenceError: angular is not defined
at Object.<anonymous> (c:\Users\YourUser\WebstormProjects\angularjs-template\app\app.js:6:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
App.js ist die folgende
'use strict';
// Declare app level module which depends on views, and components
angular.module('myApp', [
'ngRoute',
'myApp.view1',
'myApp.view2',
'myApp.version'
]).
config(['$routeProvider', function($routeProvider) {
$routeProvider.otherwise({redirectTo: '/view1'});
}]);
Und Ja, die Reihenfolge von Angular im HTML ist die folgende:
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="app.js"></script>
Es ist lustig, weil ich buchstäblich nur versuche, die mit WebStorm generierte Grundvorlage auszuführen.
Run-Konfiguration hat
Node Interpreter: C:\Program Files\nodejs\node.exe
Working directory: C:\Users\YourUser\WebstormProjects\angularjs-template
JavaScript file: app\app.js
After launch: http://localhost:63342/angularjs-template/app/index.html
Und Nö! Eckig ist undefiniert.
Was um alles in der Welt mache ich falsch?
EDIT: Exakte Ausgabe
"C:\Program Files (x86)\JetBrains\WebStorm 9.0.1\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" app\app.js
c:\Users\Zhuinden\WebstormProjects\angularjs-template\app\app.js:6
angular.module('myApp', [
^
ReferenceError: angular is not defined
at Object.<anonymous> (c:\Users\Zhuinden\WebstormProjects\angularjs-template\app\app.js:6:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
Process finished with exit code 8
Technisch werde ich lachen, wenn mein Problem war, dass ich angular mit installieren musste "bower install angular" mit dem Terminal, und dann musste ich 'index.html' ausführen, anstatt es als node.js App auszuführen. Weiß jemand die Wahrheit? – EpicPandaForce
Siehst du irgendeinen Fehler in der Konsole, außer 'angular ist nicht definiert'? – Grundy
@Grundy Ich postete es, was die IDE in einer Bearbeitung sagt – EpicPandaForce