node-modules / ngx-bootstrap / datepicker.js 404找不到错误

时间:2018-08-06 15:24:29

标签: asp.net-mvc angular5 systemjs ngx-bootstrap

我已经在angular 5应用程序中成功实现了ngx-bootstrap / datepicker。但是,当我尝试通过myAngular应用在myAsp.Net MVC中使用相同的组件和相同的配置时,出现以下错误。

错误:获取错误:找不到404   实例化http://localhost:xxxxx/node_modules/ngx-bootstrap/datepicker.js

似乎正在尝试查找不存在的datepicker.js。

我尝试将以下内容添加到systemjs.config.js

'ngx-bootstrap / datepicker':                 {main:'index.js',defaultExtension:'js'},

我收到此错误:

错误:无法动态翻译ES模块    加载程序插件需要通过SystemJS.config({ transpiler: 'transpiler-module' })进行配置。   实例化http://localhost:xxxxx/node_modules/ngx-bootstrap/datepicker/index.js

我已经厌倦了其他变化,例如:main:'datepicker.component.js',main:'bs-datepicker.js',main:'datepicker.module.js'等。 它们都导致相同的运输错误。

这是我的Systemjs.config.js

System.config({
    paths: {
        // paths serve as alias
        'npm:': 'node_modules/',
    },
    // map tells the System loader where to look for things
    map: {
        // our app is within the app folder
        app: '/app',

        // angular bundles
        '@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
        '@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
        '@angular/platform-browser/animations':
            'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
        '@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',
        // other libraries
        'rxjs': 'npm:rxjs',
        'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
        'ng2-bs3-modal': 'npm:/ng2-bs3-modal',
        'primeng': "npm:/primeng",
        'charts': "npm:/charts.js",
        'ag-grid-angular': "npm:/ag-grid-angular",
        'ag-grid': "npm:/ag-grid",
        'ag-grid-enterprise': "npm:/ag-grid-enterprise",
        'moment': "npm:/moment",
        'angular2-toaster': 'npm:angular2-toaster/bundles/angular2-toaster.umd.js',
        // ngx bootstrap
        "ngx-bootstrap": "npm:ngx-bootstrap",
        // ng2 typeahead
        "ng2-typeahead": "npm:ng2-typeahead@1.2.0"


    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
        app: {
            main: 'main.js',
            defaultExtension: 'js'
        },
        rxjs: {
            defaultExtension: 'js',
            main: "rx.js"
        },

        'ngx-bootstrap':
            { format: 'cjs', main: 'index.js', defaultExtension: 'js' },

        'ng2-bs3-modal':
        { main: '/bundles/ng2-bs3-modal.js', defaultExtension: 'js' },
        'ngx-bootstrap/datepicker':
            { main: 'index.js', defaultExtension: 'js' },
        'charts': { defaultExtension: 'js' },
        'primeng': {
            defaultExtension: 'js'
        },'ag-grid': {
            defaultExtension: 'js', main: "main.js"
        }, 'ag-grid-angular': {
            defaultExtension: 'js', main: "main.js"
        }, 'ag-grid-enterprise': {
            defaultExtension: 'js', main: "main.js"
        },
        'moment': {
            defaultExtension: 'js'
        },
        'angular2-moment': {
            main: './index.js',
            defaultExtension: 'js'
        },
    }
});

任何解决此问题的建议将不胜感激。

0 个答案:

没有答案