Epi*_*rce 8 javascript node.js webstorm angularjs
我是AngularJS的新手,我可能错过了在WebStorm中启动新的AngularJS项目的一些关键但不明显的步骤.
我安装了Node.JS,用npm安装了Angular,我甚至安装了凉亭,我甚至在凉亭中安装了角度,但此时我不确定我缺少什么.
在Debug上,我收到以下消息:
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)
Run Code Online (Sandbox Code Playgroud)
在运行中,我收到以下消息:
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
Run Code Online (Sandbox Code Playgroud)
App.js如下
'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'});
}]);
Run Code Online (Sandbox Code Playgroud)
是的,HTML中Angular的顺序如下:
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="app.js"></script>
Run Code Online (Sandbox Code Playgroud)
这很有趣,因为我只是试图运行使用WebStorm生成的基本模板.
运行配置有
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
Run Code Online (Sandbox Code Playgroud)
不,不!Angular未定义.
我究竟做错了什么?
编辑:确切的输出
"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
Run Code Online (Sandbox Code Playgroud)
len*_*ena 12
Angular代码不能与node.js一起运行.从WebStorm中的新Angular项目开始的步骤:
使用File/New项目创建一个新的Angular项目
打开内置终端,运行'npm install'
右键单击app/index.html,选择"Debug" - 您的Angular应用程序将在WebStorm内置服务器上运行
| 归档时间: |
|
| 查看次数: |
11036 次 |
| 最近记录: |