迁移到RC6后,我在初始化应用程序时遇到了一堆错误。
起初,我遇到了traceur not found错误,我已经解决了。
我已将正确的软件包添加到package.json
并指向system.config.js
以使用UMD文件。
然而,现在我得到了一堆其他错误,比如下面的错误(更确切地说,我得到了121个错误。
zone.js:1241 XMLHttpRequest cannot load npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.scheduleTask
(...)
33system.src.js:373 Assertion failed: loading or loaded
与此相关的是什么?我该如何解决? 我明确设置了我的服务器"请求(在服务类上)明确定义标题但我仍然遇到此问题。
其他人遇到同样的问题?
添加system.config.js和package.json以澄清
System.config.js
(function(global) {
System.config({
paths: {
'npm:': 'node_modules'
},
// map tells the System loader where to look for things
map: {
'app': 'www/build', // 'dist',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
// angular testing umd bundles
'@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
'@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
'@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
'@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
'@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
'@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
'@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',
'rxjs': 'npm:rxjs',
'primeng': 'npm:primeng',
'lodash': 'npm:lodash',
'angular2-jwt': 'npm:angular2-jwt/angular2-jwt.js',
'routes': 'app/routes',
'services': 'app/services'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {main: 'app.js', defaultExtension: 'js'},
rxjs: {defaultExtension: 'js'},
primeng: {defaultExtension: 'js'},
lodash: {main: 'index.js', defaultExtension: 'js'},
'angular2-jwt': {defaultExtension: 'js'}
}
})
})(this);
的package.json
{
"name": "my-admin",
"version": "0.0.1",
"description": "Admin UI",
"private": true,
"main": "",
"scripts": {
"postinstall": "npm run typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"typings": "typings"
},
"dependencies": {
"@angular/common": "2.0.0-rc.6",
"@angular/compiler": "2.0.0-rc.6",
"@angular/core": "2.0.0-rc.6",
"@angular/forms": "2.0.0-rc.6",
"@angular/http": "2.0.0-rc.6",
"@angular/platform-browser": "2.0.0-rc.6",
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
"@angular/router": "3.0.0-rc.2",
"angular-cli": "^1.0.0-beta.10",
"angular2-jwt": "^0.1.22",
"chart.js": "^2.2.1",
"core-js": "^2.4.1",
"lodash": "^4.15.0",
"ng2-translate": "^2.4.2",
"primeng": "^1.0.0-beta.15",
"primeui": "^4.1.12",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.11",
"systemjs": "^0.19.27",
"timsort": "^0.3.0",
"tslint": "^3.13.0",
"zone.js": "^0.6.21",
"es6-shim": "^0.35.1"
},
"devDependencies": {
"concurrently": "^2.0.0",
"del": "^2.2.0",
"eslint": "^3.1.0",
"eslint-config-google": "^0.6.0",
"fs": "0.0.2",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-concat": "^2.6.0",
"gulp-debug": "^2.1.2",
"gulp-insert": "^0.5.0",
"gulp-minify-css": "^1.2.4",
"gulp-sass": "^2.3.2",
"gulp-watch": "4.3.5",
"lite-server": "^2.2.2",
"http-server": "^0.9.0",
"run-sequence": "1.1.5",
"typescript": "^1.8.10",
"typings": "^1.0.4"
},
"repository": {
"type": "git",
"url": "<url>"
},
"author": "Myself",
"license": "ISC",
"homepage": "<url>#readme"
}