简体   繁体   English

@ ng-bootstrap / ng-bootstrap / pagination / pagination.d.ts(52,14):错误TS2304:找不到名称“ pageCount”

[英]@ng-bootstrap/ng-bootstrap/pagination/pagination.d.ts (52,14): error TS2304: Cannot find name 'pageCount'

I added ngbootstrap to an Angular2 project, following the instructions at https://ng-bootstrap.github.io/#/getting-started . 我按照https://ng-bootstrap.github.io/#/getting-started上的说明将ngbootstrap添加到Angular2项目。 But now, when I compile it, I get the Errors 但是现在,当我编译它时,我得到了错误

  • @ng-bootstrap/ng-bootstrap/pagination/pagination.d.ts (52,14): error TS1005: '=' expected. @ ng-bootstrap / ng-bootstrap / pagination / pagination.d.ts(52,14):错误TS1005:预期为'='。
  • @ng-bootstrap/ng-bootstrap/pagination/pagination.d.ts (52,23): error TS1005: ';' @ ng-bootstrap / ng-bootstrap / pagination / pagination.d.ts(52,23):错误TS1005:';' expected. 预期。
  • @ng-bootstrap/ng-bootstrap/pagination/pagination.d.ts (52,14): error TS2304: Cannot find name 'pageCount'. @ ng-bootstrap / ng-bootstrap / pagination / pagination.d.ts(52,14):错误TS2304:找不到名称“ pageCount”。

Moreover bootstrap components are not shown correctly on the website. 此外,引导程序组件未在网站上正确显示。

Here is my package.json: 这是我的package.json:

{
  "name": "webshop",
  "version": "0.1.0",
  "scripts": {
    "build": "webpack --progress",
    "build:prod": "webpack -p --progress",
    "postinstall": "typings install",
    "serve": "webpack-dev-server --inline --progress"
  },
  "dependencies": {
    "@angular/common": "2.0.0-rc.5",
    "@angular/compiler": "2.0.0-rc.5",
    "@angular/core": "2.0.0-rc.5",
    "@angular/forms": "^0.3.0",
    "@angular/http": "2.0.0-rc.5",
    "@angular/platform-browser": "2.0.0-rc.5",
    "@angular/platform-browser-dynamic": "2.0.0-rc.5",
    "@angular/router": "3.0.0-rc.1",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.5",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.8",
    "angular2-in-memory-web-api": "0.0.15",
    "bootstrap": "^4.0.0-alpha.4",
    "core-js": "2.4.0",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12"
  },
  "devDependencies": {
    "browserify": "^13.1.0",
    "html-webpack-plugin": "^2.17.0",
    "ts-loader": "^0.8.2",
    "tsify": "^1.0.7",
    "typescript": "^1.8.10",
    "typings": "^1.0.4",
    "webpack": "^1.13.1",
    "webpack-dev-server": "^1.14.1"
  }
}

and here the app.module.ts: 这里是app.module.ts:

     import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { NavbarModule } from './navbar';

import { AppComponent } from './app.component';


@NgModule({
    imports: [ NgbModule.forRoot(), BrowserModule, NavbarModule ],
    declarations: [ AppComponent ],
    bootstrap: [ AppComponent ]
})

export class AppModule { }

I do not have a system.js 我没有system.js

I'm not 100% certain, but I think it's related to the version of typescript in use. 我不确定100%,但是我认为这与所使用的打字稿版本有关。 ng-bootstrap has started using some of the typescript v2 features which were breaking changes from typescript v1.8. ng-bootstrap已开始使用某些打字稿v2功能,这些功能打破了打字稿v1.8的更改。 The VS extension you get from the gallery implements v1.8 so it cant compile ng-bootstrap any more. 您从图库获得的VS扩展实现了v1.8,因此无法再编译ng-bootstrap。

[edit] Fixed it! [编辑]修复它! You need to update visual studio 2015 to update 3, download and install the new typescript 2 tools from here; 您需要更新Visual Studio 2015来更新3,从此处下载并安装新的Typescript 2工具。 https://www.microsoft.com/en-us/download/details.aspx?id=48593 then edit your .csproj file and change this tag https://www.microsoft.com/zh-cn/download/details.aspx?id=48593,然后编辑.csproj文件并更改此标签

<TypeScriptToolsVersion>1.8</TypeScriptToolsVersion> 

to say

<TypeScriptToolsVersion>2.0</TypeScriptToolsVersion>

Then VS will build with the latest typescript, recognise the new language features and build ok. 然后,VS将使用最新的打字稿进行构建,识别新的语言功能并进行构建。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误TS2304:将ng-bootstrap添加到Angular2的TypeScript快速入门时,找不到名称&#39;NGB_PRECOMPILE&#39; - error TS2304: Cannot find name 'NGB_PRECOMPILE' when adding ng-bootstrap to Angular2 quick start for TypeScript 错误 TS2307:找不到模块“@ng-bootstrap/ng-bootstrap” - error TS2307: Cannot find module '@ng-bootstrap/ng-bootstrap' Angular 4中的Ng-Bootstrap分页 - Ng-Bootstrap Pagination in Angular 4 TypeScript 和 ng2 rc.1 获取错误:(20, 15) TS2304:找不到名称“模块” - TypeScript and ng2 rc.1 getting Error:(20, 15) TS2304: Cannot find name 'module' ng2-material:错误TS2304:找不到名称“进程” - ng2-material: error TS2304: Cannot find name 'process' node_modules / ngx-bootstrap / chronos / utils / type-checks.d.ts(8,62)中的错误:错误TS2304:找不到名称“提取” - ERROR in node_modules/ngx-bootstrap/chronos/utils/type-checks.d.ts(8,62): error TS2304: Cannot find name 'Extract' 错误:安装 ng add @ng-bootstrap/ng-bootstrap - Error : installing ng add @ng-bootstrap/ng-bootstrap src / polyfills.ts(73,1)中的ERROR时出现web-pack错误:错误TS2304:找不到名称“ global”。 [ng] src / polyfills.ts(73,17): - web-pack error when ERROR in src/polyfills.ts(73,1): error TS2304: Cannot find name 'global'. [ng] src/polyfills.ts(73,17): TS2304:找不到名称“条带” - TS2304: Cannot find name 'stripe' TS2304:找不到名称“路由器” - TS2304: Cannot find name 'Router'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM