I remove the browser.d.ts from the angular2 folder. The duplication errors
gone. Then, I have to remove ///<reference
path="node_modules/angular2/typings/browser.d.ts"/> , as it will cause file
no found error. The remaining errors are ,
[0] public/js/acApp/app.component.ts(3,2): error TS2304: Cannot find name
'Component'.[0] public/js/acApp/app.component.ts(8,2): error TS2304: Cannot
find name 'View'.[0] public/js/acApp/app.component.ts(21,16): error TS2304:
Cannot find name 'RouterOutlet'.[0] public/js/acApp/app.component.ts(23,2):
error TS2304: Cannot find name 'RouteConfig'.
My folder structure is
-node_modules-public--js---acApp----main.ts----app.component.js
main.ts is updated to ,
import {bootstrap} from '../../../node_modules/angular2/platform/browser'import
{AppComponent} from './app.component'// Add all operators to Observableimport
'rxjs/Rx'
bootstrap(AppComponent);
On Tuesday, 22 March 2016 23:23:10 UTC+8, Nedved Yang wrote:
>
> Hi,
>
> In my main.ts, I include the workaround following
> https://github.com/angular/angular/blob/master/CHANGELOG.md
>
> ///<reference path="../../../node_modules/angular2/typings/browser.d.ts"/>
>
>
> import {bootstrap} from 'angular2/platform/browser'
> import {AppComponent} from './app.component'
> // Add all operators to Observable
> import 'rxjs/Rx'
>
> bootstrap(AppComponent);
>
> And in tsconfig.json, browser.d.ts and browser are excluded.
>
> {
> "compilerOptions": {
> "target": "es5",
> "module": "system",
> "moduleResolution": "node",
> "sourceMap": true,
> "emitDecoratorMetadata": true,
> "experimentalDecorators": true,
> "removeComments": false,
> "noImplicitAny": false
> },
> "exclude": [
> "typings/browser.d.ts",
> "typings/browser",
> "node_modules"
> ]
> }
>
> In my index.html's head, app.use('/scripts', express.static(__dirname +
> '/node_modules'));
>
> <!-- 1. Load libraries -->
> <!-- IE required polyfills, in this exact order -->
> <script src="/scripts/es6-shim/es6-shim.min.js"></script>
> <script src="/scripts/systemjs/dist/system-polyfills.js"></script>
> <script
> src="/scripts/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
> <script src="/scripts/angular2/bundles/angular2-polyfills.js"></script>
> <script src="/scripts/systemjs/dist/system.src.js"></script>
> <script src="/scripts/rxjs/bundles/Rx.js"></script>
> <script src="/scripts/angular2/bundles/angular2.dev.js"></script>
> <!-- 2. Configure SystemJS -->
> <script>
> System.config({
> packages: {
> app: {
> format: 'register',
> defaultExtension: 'js'
> }
> }
> });
> System.import('../js/acApp/main.ts')
> .then(null, console.error.bind(console));
> </script>
>
> package.json
>
> {
> "name": "AC",
> "version": "0.0.1",
> "private": true,
> "scripts": {
> "start": "concurrently \"npm run tsc:w\" \"nodemon server.js\" ",
> "tsc": "tsc",
> "tsc:w": "tsc -w",
> "lite": "lite-server",
> "typings": "typings",
> "postinstall": "typings install"
> },
> "dependencies": {
> "bcrypt-nodejs": "*",
> "body-parser": "*",
> "cookie-parser": "*",
> "ejs": "*",
> "errorhandler": "*",
> "express": "4.x",
> "express-json": "*",
> "express-session": "*",
> "method-override": "*",
> "morgan": "*",
> "mysql": "*",
> "nodemon": "^1.9.1",
> "passport": "*",
> "passport-local": "*",
> "serve-favicon": "*",
> "bcrypt":"*",
> "cookie-parser":"*",
> "express-session":"*",
> "bookshelf":"*",
> "passport": "*",
> "passport-local": "*",
> "knex":"*",
> "log4js":"*",
> "express-session":"*",
> "angular2": "*",
> "traceur":"*",
> "systemjs": "*",
> "es6-promise": "*",
>
> "es6-shim": "^0.35.0",
>
> "reflect-metadata": "0.1.2",
>
> "rxjs": "5.0.0-beta.2",
>
> "zone.js": "^0.6.4"
> },
> "devDependencies": {
> "concurrently": "^2.0.0",
> "lite-server": "^2.1.0",
> "typescript": "^1.8.9",
> "typings":"^0.7.9"
> }
> }
>
> But I have still got the duplicate errors. Any idea?
>
> [0] 16:47:12 - File change detected. Starting incremental compilation...
> [0] node_modules/angular2/typings/browser.d.ts(6,14): error TS2300: Duplicate
> identifier 'PromiseConstructor'.
> [0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(22,5):
> error TS2300: Duplicate identifier 'done'.
> [0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(23,5):
> error TS2300: Duplicate identifier 'value'.
> [0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(46,5):
> error TS2300: Duplicate identifier 'size'.
> [0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(52,5):
> error TS2300: Duplicate identifier 'prototype'.
> [0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(66,5):
> error TS2300: Duplicate identifier 'size'.
> [0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(72,5):
> error TS2300: Duplicate identifier 'prototype'.
> [0] node_modules/angular2/typings/es6-collections/es6-collections.d.ts(88,5):
> error TS2300: Duplicate identifier 'prototype'.
> [0]
> node_modules/angular2/typings/es6-collections/es6-collections.d.ts(103,5):
> error TS2300: Duplicate identifier 'prototype'.
> [0] node_modules/angular2/typings/es6-promise/es6-promise.d.ts(11,15): error
> TS2300: Duplicate identifier 'Promise'.
> [0] node_modules/angular2/typings/es6-promise/es6-promise.d.ts(42,16): error
> TS2300: Duplicate identifier 'Promise'.
> [0] public/js/acApp/app.component.ts(3,2): error TS2304: Cannot find name
> 'Component'.
> [0] public/js/acApp/app.component.ts(8,2): error TS2304: Cannot find name
> 'View'.
> [0] public/js/acApp/app.component.ts(21,16): error TS2304: Cannot find name
> 'RouterOutlet'.
> [0] public/js/acApp/app.component.ts(23,2): error TS2304: Cannot find name
> 'RouteConfig'.
> [0] public/js/acApp/app.component.ts(24,69): error TS2304: Cannot find name
> 'UserTimelineComponent'.
> [0] typings/main/ambient/es6-shim/index.d.ts(11,5): error TS2300: Duplicate
> identifier 'done'.
> [0] typings/main/ambient/es6-shim/index.d.ts(12,5): error TS2300: Duplicate
> identifier 'value'.
> [0] typings/main/ambient/es6-shim/index.d.ts(477,11): error TS2300: Duplicate
> identifier 'Promise'.
> [0] typings/main/ambient/es6-shim/index.d.ts(496,11): error TS2300: Duplicate
> identifier 'PromiseConstructor'.
> [0] typings/main/ambient/es6-shim/index.d.ts(554,13): error TS2300: Duplicate
> identifier 'Promise'.
> [0] typings/main/ambient/es6-shim/index.d.ts(563,5): error TS2300: Duplicate
> identifier 'size'.
> [0] typings/main/ambient/es6-shim/index.d.ts(572,5): error TS2300: Duplicate
> identifier 'prototype'.
> [0] typings/main/ambient/es6-shim/index.d.ts(583,5): error TS2300: Duplicate
> identifier 'size'.
> [0] typings/main/ambient/es6-shim/index.d.ts(592,5): error TS2300: Duplicate
> identifier 'prototype'.
> [0] typings/main/ambient/es6-shim/index.d.ts(607,5): error TS2300: Duplicate
> identifier 'prototype'.
> [0] typings/main/ambient/es6-shim/index.d.ts(621,5): error TS2300: Duplicate
> identifier 'prototype'.
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.