expo/expo-asset-utils

TypeError: FileSystem.downloadAsync is not a function.

Sanva opened this issue ยท 0 comments

Sanva commented

Hi!!

In a newly created expo app I'm trying to use expo-asset-utils, but it just wont work, and I simply don't understand why ๐Ÿ˜•

Steps to reproduce:

  1. expo init expo-test02 โ€” Using blank template and npm.
  2. cd expo-test02
  3. npm install --save expo-asset-utils
  4. Edit App.js simply adding:
import AssetUtils from 'expo-asset-utils';

const remoteImage = 'https://upload.wikimedia.org/wikipedia/en/1/17/Batman-BenAffleck.jpg';
AssetUtils.resolveAsync(remoteImage).then(asset => console.log(asset));
  1. expo start and run the app.

Ignoring the fact that trying to log that object may have not sense at all, the problem I have is that AssetUtils.resolveAsync can't be called at all:

[Unhandled promise rejection: TypeError: FileSystem.downloadAsync is not a function. (In 'FileSystem.downloadAsync(url, localUri, {]
- node_modules/expo-asset-utils/src/fileInfoAsync.js:64:62 in <unknown>
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:271:30 in invoke
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:135:28 in invoke
- node_modules/regenerator-runtime/runtime.js:170:17 in <unknown>
- node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo
- node_modules/promise/setimmediate/core.js:200:23 in doResolve
- node_modules/promise/setimmediate/core.js:66:12 in Promise
- node_modules/regenerator-runtime/runtime.js:169:27 in callInvokeWithMethodAndArg
- node_modules/regenerator-runtime/runtime.js:192:38 in enqueue
- node_modules/regenerator-runtime/runtime.js:216:8 in async
* fileInfoAsync@http://192.168.0.135:19005/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false&assetPlugin=%2Fhome%2Fvalentin%2FEscritorio%2Fexpo-test%2Fnode_modules%2Fexpo%2Ftools%2FhashAssetFiles.js:150288:38 in <unknown>
- node_modules/expo-asset-utils/src/fromUriAsync.js:20:50 in fromUriAsync$
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:271:30 in invoke
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:135:28 in invoke
- node_modules/regenerator-runtime/runtime.js:170:17 in <unknown>
- node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo
- node_modules/promise/setimmediate/core.js:200:23 in doResolve
- node_modules/promise/setimmediate/core.js:66:12 in Promise
- node_modules/regenerator-runtime/runtime.js:169:27 in callInvokeWithMethodAndArg
- node_modules/regenerator-runtime/runtime.js:192:38 in enqueue
- node_modules/regenerator-runtime/runtime.js:216:8 in async
- node_modules/expo-asset-utils/src/fromUriAsync.js:19:0 in fromUriAsync
- node_modules/expo-asset-utils/src/resolveAsync.js:27:37 in resolveAsync$
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:271:30 in invoke
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:135:28 in invoke
- node_modules/regenerator-runtime/runtime.js:170:17 in <unknown>
- node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo
- node_modules/promise/setimmediate/core.js:200:23 in doResolve
- node_modules/promise/setimmediate/core.js:66:12 in Promise
- node_modules/regenerator-runtime/runtime.js:169:27 in callInvokeWithMethodAndArg
- node_modules/regenerator-runtime/runtime.js:192:38 in enqueue
- node_modules/regenerator-runtime/runtime.js:216:8 in async
- node_modules/expo-asset-utils/src/resolveAsync.js:18:21 in resolveAsync
* App.js:7:24 in <unknown>
- node_modules/metro/src/lib/polyfills/require.js:292:12 in loadModuleImplementation
- node_modules/expo/AppEntry.js:2:0 in <unknown>
- node_modules/metro/src/lib/polyfills/require.js:292:12 in loadModuleImplementation
- node_modules/metro/src/lib/polyfills/require.js:179:45 in guardedLoadModule
* null:null in global code

Looks that there is no FileSystem.downloadAsync, but I see it in https://docs.expo.io/versions/v32.0.0/sdk/filesystem/#filesystemdownloadresumabledownloadasync .

Do you know what could be missing in my system?