【发布时间】:2016-07-21 05:03:25
【问题描述】:
我正在尝试用 Angular 2 编写一个非常简单的应用程序
我需要读取 JSON 文件,因此需要 angular2/http
应用npm init 构建packages.json 文件:
{
"name": "front-end",
"version": "1.0.0",
"description": " blah blah",
"main": "gulpfile.js",
"dependencies": {
"connect": "^3.4.1",
"del": "^1.2.1",
"angular2": "2.0.0-beta.16",
"gulp": "^3.9.1",
"gulp-typescript": "^2.13.0",
"open": "^0.0.5",
"reflect-metadata": "^0.1.2",
"serve-static": "^1.10.2",
"systemjs": "^0.19.27",
"zone.js": "^0.6.12",
"rxjs": "5.0.0-beta.2"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "www.hello.com"
},
"author": "kpmg-dna-fs-de",
"license": "ISC"
}
我得到以下信息:
错误:错误:XHR 错误 (404 Not Found) loading http://localhost:9000/angular2/http.js(...)
来自 angula2.polyfills。不知道如何进行。 auth0 演示 here 表明不需要在依赖项中明确提及 angular2/http。
跟使用有什么区别:
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",
"@angular/upgrade": "2.0.0-rc.1",
如here
我的意思是:我得到了版本号,但为什么 "angular2": "2.0.0-rc.1" 不能与 npm install 一起使用?
【问题讨论】: