SDK 39 - unknown option `–assetExts’

Please provide the following:

  1. SDK Version: 39
  2. Platforms(Android/iOS/web/all): Android/iOS

Hi,

We recently updated the SDK (version 39) as we were forced to do it otherwise we weren’t able to build an APK for android.
Unfortunately, when we compile the application we have the following error:

The error is error: unknown option `–assetExts’

According to some topics in the forum, we removed the “assetExts”: [ “ttf” ] in the app, but with no fonts called in the application, it crashed after a few second.

We were aiming to launch the application this week but after spent hours we have to postpone the launch, and we have no idea how to fix it.

Thank you in advance for your help.

Hi

Try adding something like this:

    "assetBundlePatterns": [
      "assets/**/*"
    ],

See also:

please share your app.json and package.json and metro.config.js

Hi, I tried to add “assetBundlePatterns”: [ “assets/**/*” ] as suggested but it didn’t work.

Please find below app.json and package.json and metro.config.js

app.json

{
  "expo": {
    "name": "PacAnGO",
    "description": "The easy way to park",
    "slug": "pacango",
    "scheme": "pacango",
    "version": "1.0.0",
    "privacy": "unlisted",
    
    "platforms": [
      "ios",
      "android"
    ],
    "orientation": "portrait",
    "primaryColor": "#243D62",
    "icon": "./assets/images/icon.png",
    "splash": {
      "image": "./assets/images/splash.png",
      "backgroundColor": "#ffffff",
      "resizeMode": "cover"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "packagerOpts": {
      "assetExts": [
        "ttf"
      ]
    },
    "ios": {
      "bundleIdentifier": "com.pacango.app"
    },
    "android": {
      "package": "com.pacango.app"
    },
    "androidStatusBar": {
      "barStyle": "light-content",
      "translucent": false
    }
  }
}

package.json

{
  "name": "pacango",
  "version": "0.0.1",
  "private": true,
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "jest && eslint .",
    "test:watch": "jest --watch",
    "test:updateSnapshot": "jest --updateSnapshot",
    "test:coverage": "jest --coverage",
    "test:coverage:watch": "jest --coverage --watch",
    "lint:fix": "eslint --fix src",
    "postinstall": "rndebugger-open",
    "server": "json-server --watch api/db.json --routes api/apiRoutes.json --port 3004"
  },
  "devDependencies": {
    "@babel/core": "^7.11.6",
    "@babel/plugin-transform-async-to-generator": "^7.10.4",
    "@babel/preset-env": "^7.11.5",
    "babel-eslint": "10.0.3",
    "babel-jest": "^26.3.0",
    "babel-preset-expo": "^8.3.0",
    "enzyme": "3.10.0",
    "enzyme-adapter-react-16": "1.15.1",
    "enzyme-to-json": "3.4.2",
    "eslint": "6.5.1",
    "eslint-config-prettier": "6.4.0",
    "eslint-plugin-import": "2.18.2",
    "eslint-plugin-jsx-a11y": "6.2.3",
    "eslint-plugin-prettier": "3.1.1",
    "eslint-plugin-react": "7.16.0",
    "eslint-plugin-react-native": "3.7.0",
    "husky": "3.0.8",
    "jest": "^26.4.2",
    "jest-expo": "^39.0.0",
    "json-server": "0.15.1",
    "lint-staged": "9.4.2",
    "prettier": "1.18.2",
    "react-addons-test-utils": "15.6.2",
    "react-dom": "16.13.1",
    "react-native-debugger-open": "0.3.22",
    "react-native-dotenv": "0.2.0",
    "react-test-context-provider": "2.2.0",
    "react-test-renderer": "16.8.3",
    "redux-mock-store": "1.5.3"
  },
  "dependencies": {
    "@expo/vector-icons": "^10.0.0",
    "axios": "0.19.0",
    "axios-mock-adapter": "1.17.0",
    "color": "3.1.2",
    "es6-symbol": "3.1.2",
    "expo": "^39.0.0",
    "expo-asset": "~8.2.0",
    "expo-font": "~8.3.0",
    "jwt-decode": "2.2.0",
    "lodash": "4.17.15",
    "moment": "2.24.0",
    "native-base": "2.13.8",
    "react": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.0.tar.gz",
    "react-native-calendars": "1.212.0",
    "react-native-carousel-view": "0.5.1",
    "react-native-credit-card-input": "0.4.1",
    "react-native-datepicker": "1.7.2",
    "react-native-easy-grid": "0.2.2",
    "react-native-gesture-handler": "~1.7.0",
    "react-native-network-info": "^5.2.1",
    "react-native-reanimated": "~1.13.0",
    "react-native-snap-carousel": "3.8.2",
    "react-native-star-rating": "1.1.0",
    "react-native-swipe-list-view": "2.0.3",
    "react-navigation": "4.0.10",
    "react-navigation-drawer": "2.2.2",
    "react-navigation-stack": "1.9.4",
    "react-redux": "^7.2.1",
    "redux": "4.0.4",
    "redux-devtools-extension": "2.13.8",
    "redux-form": "8.2.6",
    "redux-thunk": "2.3.0",
    "whatwg-fetch": "3.0.0",
    "yarn": "^1.22.4"
  },
  "husky": {
    "hooks": {
      "pre-commit": "yarn test"
    }
  }
}

metro.config.js
file located in \node_modules\react-native

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 * @format
 */

'use strict';

const getPolyfills = require('./rn-get-polyfills');

/**
 * This cli config is needed for development purposes, e.g. for running
 * integration tests during local development or on CI services.
 */
module.exports = {
  resolver: {
    extraNodeModules: {
      'react-native': __dirname,
    },
  },
  serializer: {
    getPolyfills,
  },
};

Thank you for your help

related: https://github.com/expo/expo-cli/issues/2760

this seems to possibly arise from some strange node environment situation. i don’t know what it could be from but you could try uninstalling all of your global packages and see if that helps. you might want to try running which expo to see which version is being used. we don’t actually pass in the assetExts flag anywhere from expo-cli anymore, so it’s not going to be the latest version, i think there is some old expo-cli installation on your machine that is being used.

1 Like

Thanks for your reply,
There are different people with different machine (windows/mac) working on this project. On my machine I have the following setup:
node.js 12.13.0
expo-cli 3.27.13
SDK 39

Is this configuration suitable for the latest version of Expo?
I am trying to create a baseline machine setup that will avoid any further problem.
Thanks again for your help

yeah that node version is fine. the requirements are listed here: https://docs.expo.io/get-started/installation/#1-expo-cli - node 12 is a LTS release. you could bump that to 12.19.0 though and it wouldn’t hurt.

if it doesn’t work with that set up then i refer back to my previous comment of something not being quite right about the node set up / configuration on the machine, and suggest that you look to see if there are somehow multiple installations of expo-cli, eg: maybe you use nvm and there is an installation of expo-cli with the system version of node, and the path may take precedence over the nvm global node_modules path

We installed all the requirements on a new machine. We still have the same as mentioned in my previous post.
The error is error: unknown option `–assetExts’

We might find a workaround by creating a new metro.config.js file in the root of the project (not the one that I paste previously…) and adding the code below in app.json

 "packagerOpts": {
    "config": "metro.config.js"
  }

This might resolve the problem as we made some tests, however, we are not familiar with metro.config,js, so we need an example that load the external assets such as “assetExts”: [
“ttf” ]

Thank you again for your help.

1 Like

What I would try next is create a new Expo project and start comparing all of the config files between the two apps and modifying your app’s config to look more like the new app, while at the same time modifying the new app’s config to look more like your app.

Hopefully at some point you will either fix your app or break the new app. At that point you should have a better idea of what is xausing the problem.

Alternatively, create a new app and copy all the code and assets across. Check if it works.