簡體   English   中英

Angular2 / Nativescript:嘗試構建/運行任何項目時出現奇怪的模糊錯誤

[英]Angular2/Nativescript: Strange vague error when trying to build/run Any project

在過去的兩個月中,我一直在開發Angular2 Nativescript應用程序。上一次我從事該項目的時間大約是一周前,所有內容編譯時都沒有任何問題,然后當我嘗試構建並運行該應用程序時genymotion模擬器出現以下錯誤。 知道為什么會這樣嗎? 它似乎與我從未接觸過的節點模塊有關...幾天前,當我重新安裝angular-cli時,我清除了npm緩存,不確定是否可能導致此問題?

更新:我嘗試運行nativescript sample-groceries應用程序,並得到了完全相同的錯誤,因此我確定它與我的Nativescript安裝有關...我嘗試使用npm uninstall -g nativescript卸載nativescript,然后使用npm clear cache進行卸載。 然后我用npm install -g nativescript @ latest重新安裝,但仍然沒有任何變化,我在嘗試運行任何nativescript項目時遇到了完全相同的錯誤...我正在使用Nativescript 2.4.1 ...

我在Windows命令提示符下的全部輸入/輸出:

C:\Users\User1\Documents\nativescript\barcode-scanner>tns run android --geny "nexus" --watch
Executing before-prepare hook from C:\Users\User1\Documents\nativescript\barcode-scanner\hooks\before-prepare\nativescript-dev-android-snapshot.js                                                                                               Executing before-prepare hook from C:\Users\Deon\Documents\nativescript\barcode-scanner\hooks\before-prepare\nativescript-dev-typescript.js                                                                                                     Found peer TypeScript 2.0.10
node_modules/tns-core-modules/es-collections.d.ts(30,14): error TS2300: Duplicate identifier 'MapConstructor'.

node_modules/tns-core-modules/es-collections.d.ts(31,14): error TS2300: Duplicate identifier 'SetConstructor'.

../../node_modules/@types/node/index.d.ts(38,11): error TS2300: Duplicate identifier 'MapConstructor'.
../../node_modules/@types/node/index.d.ts(40,11): error TS2300: Duplicate identifier 'SetConstructor'.
../../node_modules/@types/node/index.d.ts(49,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'global' must be of type 'any', but here has type 'Global'.                                                 ../../node_modules/@types/node/index.d.ts(73,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'require' must be of type 'NativeScriptRequire', but here has type 'NodeRequire'.                           ../../node_modules/@types/node/index.d.ts(85,13): error TS2403: Subsequent variable declarations must have the same type.  Variable 'module' must be of type 'NativeScriptModule', but here has type 'NodeModule'.                              ../../node_modules/@types/node/index.d.ts(3993,5): error TS2309: An export assignment cannot be used in a module with other exported elements.                                                                                                                                                                                                                          TypeScript compiler failed with exit code 1

所以事實證明,問題是我在本地Nativescript應用程序的node_modules中安裝的Typescript版本... 2.0.2以上的任何版本都給我這個問題。 <= 2.0.2構建沒有問題。 我將接受任何可以解釋此問題的答案,否則我將在另一個問題中繼續“為什么” ...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM