2016-08-29 2 views
4

Я создаю приложение для создания углов2. Я использую угловое/material2 для лучшего дизайна. Что касается строительства проекта - я использую глоток.gulp typescript: error TS1005

Постановка проблемы: Я изменил @angular/router-deprecated к @angular/router и была вынуждена обновить другие пакеты (@angular/core, @angular2-material и т.д.)

После этого глоток сборка перестала работать и показать следующие ошибки:

.../node_modules/@angular2-material/button/button.d.ts(28,14): error TS1005: '=' expected 
.../node_modules/@angular2-material/button/button.d.ts(28,22): error TS1005: ';' expected 
.../node_modules/@angular2-material/button/button.d.ts(29,14): error TS1005: '=' expected 
.../node_modules/@angular2-material/button/button.d.ts(29,28): error TS1005: ';' expected 
.../node_modules/@angular2-material/input/input.d.ts(50,14): error TS1005: '=' expected. 
.../node_modules/@angular2-material/input/input.d.ts(50,21): error TS1005: ';' expected. 
.../node_modules/@angular2-material/input/input.d.ts(51,14): error TS1005: '=' expected. 
.../node_modules/@angular2-material/input/input.d.ts(51,19): error TS1005: ';' expected. 

Моей глотки код компиляции выглядит следующим образом:

const gulp = require('gulp'); 
const tsc = require('gulp-typescript'); 
const sourcemaps = require('gulp-sourcemaps'); 
const tsProject = tsc.createProject('tsconfig.json'); 

module.exports = function() { 
    const tsResult = gulp.src('src/**/*.ts') 
    .pipe(sourcemaps.init()) 
    .pipe(tsc(tsProject)); 

    return tsResult.js 
    .pipe(sourcemaps.write(".")) 
    .pipe(gulp.dest("dist")); 
}; 

main.ts:

///<reference path="../../typings/index.d.ts"/> 
import { bootstrap } from '@angular/platform-browser-dynamic'; 

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

import { HTTP_PROVIDERS } from '@angular/http'; 

bootstrap(AppComponent, [HTTP_PROVIDERS]); 

tsconfig.json:

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "removeComments": false, 
    "noImplicitAny": false, 
    "outDir": "dist/app" 
    }, 
    "exclude": [ 
    "node_modules" 
    ] 
} 

package.json:

{ 
    "name": "fallball", 
    "version": "1.0.0", 
    "scripts": { 
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ", 
    "lite": "lite-server", 
    "postinstall": "typings install", 
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "typings": "typings" 
    }, 
    "dependencies": { 
    "@angular/common": "2.0.0-rc.5", 
    "@angular/compiler": "2.0.0-rc.5", 
    "@angular/core": "2.0.0-rc.5", 
    "@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/upgrade": "2.0.0-rc.5", 
    "angular2-in-memory-web-api": "0.0.15", 
    "core-js": "^2.4.0", 
    "es6-shim": "^0.35.0", 
    "@angular2-material/button": "^2.0.0-alpha.7-9", 
    "@angular2-material/card": "2.0.0-alpha.7-9", 
    "@angular2-material/core": "^2.0.0-alpha.7-9", 
    "@angular2-material/toolbar": "^2.0.0-alpha.7-9", 
    "@angular2-material/input": "2.0.0-alpha.7-9", 
    "reflect-metadata": "^0.1.3", 
    "rxjs": "5.0.0-beta.6", 
    "systemjs": "0.19.27", 
    "zone.js": "^0.6.12", 
    "bootstrap": "^3.3.6", 
    "gulp": "^3.9.1" 
    }, 
    "devDependencies": { 
    "concurrently": "^2.0.0", 
    "gulp": "^3.9.1", 
    "gulp-sourcemaps": "^1.6.0", 
    "gulp-typescript": "^2.13.6", 
    "gulp-webserver": "^0.9.1", 
    "lite-server": "^2.2.0", 
    "typescript": "^2.0.0", 
    "typings": "^1.3.1" 
    } 
} 

Не могли бы вы уточнить, если проблема с сломанных пакетов, или я не настроить что-то неправильно? Спасибо!

+0

Вы пытались использовать TypeScript 1.8.10? Вы получаете ту же ошибку при использовании tsc из вашего пакета.json? – DaSch

ответ

2

Вам необходимо обновить typesript до 2.0.0

У меня тот же вопрос, и я прошу их здесь: https://github.com/angular/material2/issues/1208

Надеется, что поможет вам!

+0

обновлен до машинописного текста 2 RC и до сих пор происходит – nadav

+0

@nadav удалите свою директорию 'node_modules', измените версию машинописного текста в свой' package.json' и выполните 'npm install' – user3805731

+0

Привет, я новичок в написании скрипта. Я использую версию «^ 2.0.3» и gulp-typescript как «^ 2.8.0» в package.json. Но на gulp build я столкнулся с той же проблемой TS1005: '=' ожидается. Любая помощь приветствуется. Благодаря! – Danda

Смежные вопросы