我提到this包含angular-tree-component插件。我按照确切的步骤操作应用程序时出现以下错误:
错误:(SystemJS)ctorParameters.map不是函数(...)
我的package.json文件:
{
"name": "template2",
"version": "1.0.0",
"scripts": {},
"license": "ISC",
"dependencies": {
"@angular/common": "~2.0.1",
"@angular/compiler": "~2.0.1",
"@angular/core": "~2.0.1",
"@angular/forms": "~2.0.1",
"@angular/http": "~2.0.1",
"@angular/platform-browser": "~2.0.1",
"@angular/platform-browser-dynamic": "~2.0.1",
"@angular/router": "~3.0.1",
"@angular/upgrade": "~2.0.1",
"angular-tree-component": "3.6.0",
"angular2-modal": "^2.0.3",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"ng-lightning": "^1.3.0",
"ng2-bs3-modal": "^0.10.4",
"ng2-dragula": "^1.3.1",
"ng2-modal-dialog": "^1.0.1",
"ngx-modal": "0.0.29",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.39",
"zone.js": "^0.6.25"
},
"devDependencies": {
"@types/core-js": "^0.9.34",
"typescript": "^2.0.3",
"typings": "^1.4.0"
}
}
我的Systemjs.config.js
/**
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': '/node_modules/',
},
// map tells the System loader where to look for things
//defaultJSExtensions: true, // This is included for Model Popup
map: {
// our app is within the app folder
app: '/Scripts',
// angular bundles
'@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/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/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
/*The following is required by dragula */
'dragula': 'node_modules/dragula',
'ng2-dragula': 'node_modules/ng2-dragula',
'contra': 'node_modules/contra',
'atoa': 'node_modules/atoa',
'ticky': 'node_modules/ticky',
'crossvent': 'node_modules/crossvent/src',
'custom-event': 'node_modules/custom-event',
/*The following is required by dragula ^*/
'angular-tree-component': 'node_modules/angular-tree-component/dist/angular-tree-component.umd.js',
//The following is required by PopUp Model
"ngx-modal": "node_modules/ngx-modal",
// other libraries
'rxjs': 'npm:rxjs'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
/*The following is required by dragula */
'dragula': { main: 'dragula.js', defaultExtension: 'js' },
'ng2-dragula': { defaultExtension: 'js' },
'contra': { main: 'contra.js', defaultExtension: 'js' },
'atoa': { main: 'atoa.js', defaultExtension: 'js' },
'ticky': { main: 'ticky.js', defaultExtension: 'js' },
'crossvent': { main: 'crossvent.js', defaultExtension: 'js' },
'custom-event': { main: 'index.js', defaultExtension: 'js' },
/*The following is required by dragula ^*/
'angular2-modal': {
main: 'bundles/angular2-modal.umd',
defaultExtension: 'js'
},
"angular2-modal/plugins/bootstrap": {
main: 'angular2-modal.bootstrap.umd',
defaultExtension: 'js'
},
"ngx-modal": { "main": "index.js", "defaultExtension": "js" },
rxjs: {
defaultExtension: 'js'
}
}
});
})(this);
我尝试了其他插件,如Dragula和ngx-modal,似乎工作正常。它是与Angular树组件有关还是只是一些构建错误?
答案 0 :(得分:0)
将您的Package.json文件更新到最新的稳定版本,就像我使用的是角度版本2.4.10,但您可以使用最新的角度版本4.1.3及其相关的兼容软件包版本
"dependencies": {
"@angular/animations": "2.4.10",
"@angular/common": "2.4.10",
"@angular/compiler": "2.4.10",
"@angular/core": "2.4.10",
"@angular/forms": "2.4.10",
"@angular/http": "2.4.10",
"@angular/platform-browser": "2.4.10",
"@angular/platform-browser-dynamic": "2.4.10",
"@angular/platform-server": "2.4.10",
"@angular/router": "3.0.1",
"@types/lodash": "^4.14.63",
"angular-tree-component": "3.4.0",
"core-js": "^2.4.1",
"debug": "~2.6.3",
"ejs": "^2.3.3",
"express": "~4.15.2",
"rxjs": "^5.0.0",
"serve-favicon": "~2.4.2",
"twilio": "^2.11.1",
"zone.js": "^0.8.4"
}