transistorsoft / nativescript-background-fetch

iOS Background Fetch API Implementation for NativeScript
Other
28 stars 9 forks source link

Cannot Find Name #5

Open ShawnPavel opened 7 years ago

ShawnPavel commented 7 years ago

I am attempting to update to v1.1.1 and I get the following errors on compilation:

node_modules/nativescript-background-fetch/background-fetch.ios.d.ts(3,59): error TS2304: Cannot find name 'UIApplication'.

node_modules/nativescript-background-fetch/background-fetch.ios.d.ts(8,28): error TS2304: Cannot find name 'UIBackgroundFetchResult'.
christocracy commented 7 years ago

Add references.d.ts in your app folder.

ShawnPavel commented 7 years ago

I added the reference like so:

/// <reference path="./node_modules/nativescript-background-fetch/references.d.ts" />

Now I get two more errors looking for tns-platform-declarations in the plugin's node_modules folder:

node_modules/nativescript-background-fetch/background-fetch.ios.d.ts(3,59): error TS2304: Cannot find name 'UIApplication'.

node_modules/nativescript-background-fetch/background-fetch.ios.d.ts(8,28): error TS2304: Cannot find name 'UIBackgroundFetchResult'.

node_modules/nativescript-background-fetch/references.d.ts(1,1): error TS6053: File '/Users/shawnpavel/Development/mobileClassic/node_modules/nativescript-background-fetch/node_modules/tns-platform-declarations/ios.d.ts' not found.

node_modules/nativescript-background-fetch/references.d.ts(2,1): error TS6053: File '/Users/shawnpavel/Development/mobileClassic/node_modules/nativescript-background-fetch/node_modules/tns-platform-declarations/android.d.ts' not found.
christocracy commented 7 years ago

$ tns plugin remove nativescript-background-geolocation-lt $ tns plugin remove nativescript-background-fetch $tns platform remove ios $ tns platform remove android $ tns plugin add nativescript-background-geolocation-lt

Rebuild/run

ShawnPavel commented 7 years ago

Doing exactly as you have written above, I get the same errors as above. If I change the references line to reference background-geolocation's references.d.ts file I get this instead:

node_modules/nativescript-background-fetch/background-fetch.ios.d.ts(3,59): error TS2304: Cannot find name 'UIApplication'.

node_modules/nativescript-background-fetch/background-fetch.ios.d.ts(8,28): error TS2304: Cannot find name 'UIBackgroundFetchResult'.

node_modules/nativescript-background-geolocation-lt/references.d.ts(1,1): error TS6053: File '/Users/shawnpavel/Development/mobileClassic/node_modules/nativescript-background-geolocation-lt/node_modules/tns-platform-declarations/ios.d.ts' not found.

node_modules/nativescript-background-geolocation-lt/references.d.ts(2,1): error TS6053: File '/Users/shawnpavel/Development/mobileClassic/node_modules/nativescript-background-geolocation-lt/node_modules/tns-platform-declarations/android.d.ts' not found.

node_modules/nativescript-background-geolocation-lt/references.d.ts(4,14): error TS2300: Duplicate identifier 'FormData'.
node_modules/nativescript-background-geolocation-lt/references.d.ts(5,14): error TS2300: Duplicate identifier 'Headers'.
node_modules/nativescript-background-geolocation-lt/references.d.ts(6,14): error TS2300: Duplicate identifier 'RequestInit'.
node_modules/nativescript-background-geolocation-lt/references.d.ts(7,14): error TS2300: Duplicate identifier 'Response'.
node_modules/nativescript-background-geolocation-lt/references.d.ts(8,14): error TS2300: Duplicate identifier 'Console'.

node_modules/tns-core-modules/declarations.d.ts(15,11): error TS2300: Duplicate identifier 'RequestInit'.

node_modules/tns-core-modules/declarations.d.ts(36,15): error TS2300: Duplicate identifier 'Headers'.
node_modules/tns-core-modules/declarations.d.ts(56,15): error TS2300: Duplicate identifier 'Response'.
node_modules/tns-core-modules/declarations.d.ts(87,11): error TS2300: Duplicate identifier 'Console'.

node_modules/typescript/lib/lib.d.ts(6134,11): error TS2300: Duplicate identifier 'Console'.

node_modules/typescript/lib/lib.d.ts(6159,13): error TS2300: Duplicate identifier 'Console'.
node_modules/typescript/lib/lib.d.ts(7621,11): error TS2300: Duplicate identifier 'FormData'.
node_modules/typescript/lib/lib.d.ts(7625,13): error TS2300: Duplicate identifier 'FormData'.

I confirmed that there is not a node_modules/tns-core-modules within the nativescript-background-geolocation-lt folder. Which is where it is looking according to the error.

Note: I'm running the 2.5 version of nativescript at the moment. tns-info:

┌──────────────────┬─────────────────┬────────────────┬──────────────────┐
│ Component        │ Current version │ Latest version │ Information      │
│ nativescript     │ 2.5.5           │ 3.2.1          │ Update available │
│ tns-core-modules │ 2.5.1           │ 3.2.0          │ Update available │
│ tns-android      │ 2.5.0           │ 3.2.0          │ Update available │
│ tns-ios          │                 │ 3.2.0          │ Not installed    │
└──────────────────┴─────────────────┴────────────────┴──────────────────┘
christocracy commented 7 years ago

Come chat me at my web site: http://www.transistorsoft.com

frpatino6 commented 5 years ago

i have a same error,