【问题标题】:Angular2/Nativescript: Strange vague error when trying to build/run Any projectAngular2/Nativescript:尝试构建/运行任何项目时出现奇怪的模糊错误
【发布时间】:2017-01-24 11:57:26
【问题描述】:

在过去的两个月里,我一直在开发一个 Angular2 Nativescript 应用程序......我最后一次从事这个项目是在大约一周前,所有编译的东西都没有任何问题,然后当我尝试构建然后运行时genymotion 模拟器上的应用程序出现以下错误。知道为什么会这样吗?它似乎与我从未接触过的节点模块有关...几天前我在重新安装 angular-cli 时清除了 npm 缓存,不确定是否会以某种方式导致这种情况?

更新: 我尝试运行 nativescript sample-groceries 应用程序并得到完全相同的错误,所以我确定它与我的 Nativescript 安装有关......我尝试使用 npm uninstall -g nativescript 然后 npm clear cache 卸载nativescript。然后我重新安装了 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

【问题讨论】:

    标签: angular nativescript typescript-typings angular2-nativescript


    【解决方案1】:

    所以问题是我的 Typescript 版本安装在本地 Nativescript 应用程序的 node_modules 中...... 2.0.2 以上的任何版本都会给我这个问题。

    【讨论】:

      猜你喜欢
      • 2023-03-07
      • 1970-01-01
      • 2016-01-31
      • 2019-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多