Reputation: 1715
i've been working on a Angular2 Nativescript app for the past two months... The last time I worked on this project was about a week ago and everything compiled without any issues then now when I try to build and then run the app on a genymotion emulator I get the following error. Any idea why this is happening? It seems to be related to node modules that I haven't ever touched... A few days ago I cleared the npm cache when re-installing angular-cli, not sure if that could have caused this somehow?
Update: I tried running the nativescript sample-groceries app and got the exact same error so i'm sure it's related to my Nativescript installation... I tried uninstalling nativescript with npm uninstall -g nativescript and then npm clear cache. I then re-installed with npm install -g nativescript@latest but still no change i'm getting the exact same error when trying to run any nativescript project... i'm using Nativescript 2.4.1...
My entire input/output in windows command prompt:
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
Upvotes: 0
Views: 145
Reputation: 1715
So it turns out the issue was my version of Typescript that was installed in the local Nativescript app's node_modules... Any version above 2.0.2 gives me this issue. <= 2.0.2 builds with no issues. i'll accept any answer that can explain this otherwise i'll continue the "why" in another question...
Upvotes: 0