首页 文章

Angular2 / Nativescript:尝试构建/运行任何项目时出现奇怪的模糊错误

提问于
浏览
0

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

更新:我尝试运行nativescript样本杂货应用程序并得到完全相同的错误,所以我确定它与我的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

1 回答

  • 0

    所以事实证明问题是我在本地Nativescript应用程序的node_modules中安装的Typescript版本......任何高于2.0.2的版本都给了我这个问题 . <= 2.0.2构建没有问题 . 我会接受任何可以解释这个问题的答案,否则我会在另一个问题中继续“为什么”......

相关问题