昨天我遇到了一個與我的NS NG2應用程序的問題。每當我嘗試運行命令 - tns livesync android --watch或任何其他命令來構建。我收到了很長的錯誤列表。下面是這個錯誤的一小部分。Typescript - 重複的標識符
app/node_modules/typescript/lib/lib.es6.d.ts(20054,15): error TS2451: Cannot red
eclare block-scoped variable 'name'.
app/node_modules/typescript/lib/lib.es6.d.ts(20328,6): error TS2300: Duplicate i
dentifier 'AAGUID'.
app/node_modules/typescript/lib/lib.es6.d.ts(20329,6): error TS2300: Duplicate i
dentifier 'AlgorithmIdentifier'.
app/node_modules/typescript/lib/lib.es6.d.ts(20330,6): error TS2300: Duplicate i
dentifier 'ConstrainBoolean'.
app/node_modules/typescript/lib/lib.es6.d.ts(20331,6): error TS2300: Duplicate i
dentifier 'ConstrainDOMString'.
app/node_modules/typescript/lib/lib.es6.d.ts(20332,6): error TS2300: Duplicate i
dentifier 'ConstrainDouble'.
app/node_modules/typescript/lib/lib.es6.d.ts(20333,6): error TS2300: Duplicate i
dentifier 'ConstrainLong'.
app/node_modules/typescript/lib/lib.es6.d.ts(20334,6): error TS2300: Duplicate i
dentifier 'CryptoOperationData'.
app/node_modules/typescript/lib/lib.es6.d.ts(20335,6): error TS2300: Duplicate i
dentifier 'GLbitfield'.
app/node_modules/typescript/lib/lib.es6.d.ts(20336,6): error TS2300: Duplicate i
dentifier 'GLboolean'.
app/node_modules/typescript/lib/lib.es6.d.ts(20337,6): error TS2300: Duplicate i
dentifier 'GLbyte'.
app/node_modules/typescript/lib/lib.es6.d.ts(20338,6): error TS2300: Duplicate i
dentifier 'GLclampf'.
app/node_modules/typescript/lib/lib.es6.d.ts(20339,6): error TS2300: Duplicate i
dentifier 'GLenum'.
app/node_modules/typescript/lib/lib.es6.d.ts(20340,6): error TS2300: Duplicate i
dentifier 'GLfloat'.
app/node_modules/typescript/lib/lib.es6.d.ts(20341,6): error TS2300: Duplicate i
dentifier 'GLint'.
app/node_modules/typescript/lib/lib.es6.d.ts(20342,6): error TS2300: Duplicate i
dentifier 'GLintptr'.
app/node_modules/typescript/lib/lib.es6.d.ts(20343,6): error TS2300: Duplicate i
dentifier 'GLshort'.
app/node_modules/typescript/lib/lib.es6.d.ts(20344,6): error TS2300: Duplicate i
dentifier 'GLsizei'.
app/node_modules/typescript/lib/lib.es6.d.ts(20345,6): error TS2300: Duplicate i
dentifier 'GLsizeiptr'.
app/node_modules/typescript/lib/lib.es6.d.ts(20346,6): error TS2300: Duplicate i
dentifier 'GLubyte'.
app/node_modules/typescript/lib/lib.es6.d.ts(20347,6): error TS2300: Duplicate i
dentifier 'GLuint'.
app/node_modules/typescript/lib/lib.es6.d.ts(20348,6): error TS2300: Duplicate i
dentifier 'GLushort'.
app/node_modules/typescript/lib/lib.es6.d.ts(20349,6): error TS2300: Duplicate i
dentifier 'IDBKeyPath'.
app/node_modules/typescript/lib/lib.es6.d.ts(20350,6): error TS2300: Duplicate i
dentifier 'KeyFormat'.
app/node_modules/typescript/lib/lib.es6.d.ts(20351,6): error TS2300: Duplicate i
dentifier 'KeyType'.
這只是一個非常小的樣本,我收到的錯誤。爲了給人留下深刻的印象,當我在我的Mac上工作時發生了這種情況,意識到我需要做的比預期的要多。所以轉移到我的電腦,我更熟悉電腦。我拉了我做的小代碼更改(已經試圖扭轉這些)並嘗試構建。那是當我遇到這個錯誤列表。我將在下面列出一些可能有助於找到答案的文件。
的package.json
{
"description": "AppName",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "AppName",
"repository": "myRepo",
"nativescript": {
"id": "org.nativescript.appName",
"tns-ios": {
"version": "2.4.0"
},
"tns-android": {
"version": "2.4.0"
}
},
"dependencies": {
"@angular/common": "2.1.2",
"@angular/compiler": "2.1.2",
"@angular/core": "2.1.2",
"@angular/forms": "2.1.2",
"@angular/http": "2.1.2",
"@angular/platform-browser": "2.1.2",
"@angular/platform-browser-dynamic": "2.1.2",
"@angular/platform-server": "^2.0.0",
"@angular/router": "3.1.2",
"email-validator": "^1.0.7",
"nativescript-angular": "1.1.3",
"nativescript-drop-down": "^1.3.3",
"nativescript-loading-indicator": "^2.2.1",
"nativescript-permissions": "^1.2.1",
"nativescript-plugin-firebase": "^3.7.1",
"nativescript-telerik-ui": "^1.4.1",
"nativescript-toasty": "^1.1.0",
"reflect-metadata": "~0.1.8",
"tns-core-modules": "2.4.0",
"tns-platform-declarations": "^2.0.0"
},
"devDependencies": {
"babel-traverse": "6.19.0",
"babel-types": "6.19.0",
"babylon": "6.11.0",
"lazy": "1.0.11",
"filewalker": "0.1.2",
"nativescript-dev-typescript": "^0.3.2",
"typescript": "^2.0.10",
"zone.js": "~0.6.21"
}
}
references.d.ts
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> Needed for autocompletion and compilation.
/// <reference path="./node_modules/nativescript-plugin-firebase/index.d.ts" />
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.es6.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/ios/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android/android17.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android/org.nativescript.widgets.d.ts" />
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true,
"lib": [
"es2016"
]
},
"exclude": [
"node_modules",
"platforms"
]
}
如果有任何其他的文件,我可以張貼,可以幫助請讓我知道。我相信問題在於其中一個文件。我嘗試了所有我能想到的東西,並且只是出於想法。希望你們中的一個人有某種想法!先進的感謝
我很驚訝,你不能重複的問題。我已經做了。使用tns創建一個項目,創建appname --ng,然後放入我的ref和包文件,它有完全相同的問題。但是我一直無法弄清楚這些文件導致這個 –