首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >加载ng2-bootstrap时出错

加载ng2-bootstrap时出错
EN

Stack Overflow用户
提问于 2017-01-31 16:47:23
回答 2查看 398关注 0票数 0

嗨,我有一个导入ng2-bootstrap的错误,这是错误,嗨,我有一个导入ng2-bootstrap的错误,这是错误,嗨,我有一个导入ng2-bootstrap的错误,这是错误:

代码语言:javascript
复制
http://localhost:3002/ng2-bootstrap/ng2-bootstrap.js 404 (Not Found)
Error: Error: XHR error (404 Not Found) loading http://localhost:3002/ng2-bootstrap/ng2-bootstrap.js
    at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:3002/node_modules/zone.js/dist/zone.js:698:29)
    at ZoneDelegate.invokeTask (http://localhost:3002/node_modules/zone.js/dist/zone.js:265:35)
    at Zone.runTask (http://localhost:3002/node_modules/zone.js/dist/zone.js:154:47)
    at XMLHttpRequest.ZoneTask.invoke (http://localhost:3002/node_modules/zone.js/dist/zone.js:335:33)
Error loading http://localhost:3002/ng2-bootstrap/ng2-bootstrap.js as "ng2-bootstrap" from http://localhost:3002/app/schedules/schedule-list.component.js

下面是systmjs.config.js:

代码语言:javascript
复制
/**
* System configuration for Angular 2 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
    map: {
        // our app is within the app folder
        app: 'app',
        // 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',
        // other libraries
        'rxjs': 'npm:rxjs',
        'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
        'jquery': 'npm:jquery/',
        'lodash': 'npm:lodash/lodash.js',

        'ng2-bootstrap/ng2-bootstrap': 'node_modules/ng2-bootstrap/bundles/ng2-bootstrap.umd.js',
        'moment': 'node_modules/moment/moment.js',
        'symbol-observable': 'npm:symbol-observable'
    },
    // 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'
        },
        'angular-in-memory-web-api': {
            main: './index.js',
            defaultExtension: 'js'
        },
        'moment': { main: 'moment.js', defaultExtension: 'js' },
        'ng2-bootstrap': { main: 'ng2-bootstrap.js', defaultExtension: 'js' },
        'symbol-observable': { main: 'index.js', defaultExtension: 'js' }
    }
});
 })(this);

package.json

代码语言:javascript
复制
{
 "version": "1.0.0",
 "name": "scheduler",

“作者”:“克里斯·萨克拉里奥斯”,“许可证”:“麻省理工学院”,“存储库”:"https://github.com/chsakell/angular2-features",“私有”:true,“依赖”:{ "@angular/common":"2.0.0",“@angular/编译器”:"2.0.0","@angular/core":"2.0.0","@angular/forms":"2.0.0","@angular/http":"2.0.0","@angular/platform-browser":"2.0.0","@angular/platform-browser-dynamic":"2.0.0","@angular/router":"3.0.0","@angular/upgrade":"2.0.0","bootstrap":"^3.3.6",

代码语言:javascript
复制
"jquery": "^3.0.0",
"lodash": "^4.13.1",
"moment": "^2.13.0",
"ng2-bootstrap": "^1.1.5",
"ng2-slim-loading-bar": "1.5.1",

"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"angular2-in-memory-web-api": "0.0.20"
 },
"devDependencies": {
"concurrently": "^2.0.0",
"del": "^2.2.0",
"gulp": "^3.9.1",
"gulp-tslint": "^5.0.0",
"jquery": "^3.0.0",
"lite-server": "^2.2.0",
"typescript": "2.0.2",
"typings": "^1.3.2",
"tslint": "^3.10.2"
 },
 "scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite --baseDir ./app --port 8000\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
}
}
EN

回答 2

Stack Overflow用户

发布于 2017-01-31 17:17:36

在path对象中:

代码语言:javascript
复制
'moment': { main: 'moment.js', defaultExtension: 'js' },
'ng2-bootstrap': { main: 'ng2-bootstrap.js', defaultExtension: 'js' }

在packages对象中:

代码语言:javascript
复制
'moment': { main: 'moment.js', defaultExtension: 'js' },
'ng2-bootstrap': { main: 'ng2-bootstrap.js', defaultExtension: 'js' },
票数 0
EN

Stack Overflow用户

发布于 2019-06-05 16:08:28

ng-2 bootstrap:此包已弃用,已重命名为ngx-bootstrap

尝试使用npm安装ngx-bootstrap

代码语言:javascript
复制
npm i ngx-bootstrap --save
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41953147

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档