Build failed of Received an instance of Object

Building optimized bundles and generating sourcemaps...
The "path" argument must be of type string. Received an instance of Object
TypeError [ERR_INVALID_ARG_TYPE] [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object
    at validateString (internal/validators.js:120:11)
    at Object.resolve (path.js:980:7)
    at Object.getResolvedLocalesAsync (/@expo/xdl@59.0.11/src/detach/ExponentTools.ts:202:40)
    at _getPublishExpConfigAsync (/@expo/xdl@59.0.11/src/Project.ts:829:37)
    at Object.publishAsync (/@expo/xdl@59.0.11/src/Project.ts:625:37)
    at action (/Users/name/.nvm/versions/node/v12.17.0/lib/node_modules/expo-cli/src/commands/publish.ts:81:18)
    at IOSBuilder.ensureReleaseExists (/Users/name/.nvm/versions/node/v12.17.0/lib/node_modules/expo-cli/src/commands/build/BaseBuilder.ts:267:33)
    at IOSBuilder.ensureProjectIsPublished (/Users/name/.nvm/versions/node/v12.17.0/lib/node_modules/expo-cli/src/commands/build/ios/IOSBuilder.ts:323:14)
    at IOSBuilder.run (/Users/name/.nvm/versions/node/v12.17.0/lib/node_modules/expo-cli/src/commands/build/ios/IOSBuilder.ts:64:29)
    at IOSBuilder.command (/Users/name/.nvm/versions/node/v12.17.0/lib/node_modules/expo-cli/src/commands/build/BaseBuilder.ts:40:7)
  Expo CLI 4.0.13 environment info:
    System:
      OS: macOS 11.0.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 12.17.0 - ~/.nvm/versions/node/v12.17.0/bin/node
      Yarn: 1.22.10 - ~/.nvm/versions/node/v12.17.0/bin/yarn
      npm: 6.14.9 - ~/.nvm/versions/node/v12.17.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 12.2/12B45b - /usr/bin/xcodebuild
    npmPackages:
      expo: ^40.0.0 => 40.0.0 
      react: 16.13.1 => 16.13.1 
      react-dom: 16.13.1 => 16.13.1 
      react-native: https://github.com/expo/react-native/archive/sdk-40.0.0.tar.gz => 0.63.2 
      react-navigation: ^4.4.3 => 4.4.3 
    npmGlobalPackages:
      expo-cli: 4.0.13
    Expo Workflow: managed

please explain how you got this error and provide a reproducible example if possible. at the very least, share your app.json with anything sensitive removed.

Sure of course. I have been developing in Expo app for a while now, starting SDK 39, just upgraded to SDK 40. During this period, I did not try to build the app. It was my first time trying to build the app yesterday with expo build:ios -t simulator.

My app.config.ts

import { ExpoConfig } from '@expo/config'

export default (): ExpoConfig => ({
  name: 'the-app',
  description: 'This is a description',
  slug: 'the-app',
  privacy: 'hidden',
  version: '1.0.0',
  platforms: ['ios'],
  orientation: 'portrait',
  userInterfaceStyle: 'automatic',
  icon: './assets/icon.png',
  developmentClient: { silentLaunch: true },
  scheme: 'testscheme',
  ios: {
    bundleIdentifier: 'com.test.the-app',
    infoPlist: {
      CFBundleAllowMixedLocalizations: true
    },
    splash: {
      image: './assets/splash.png',
      resizeMode: 'contain',
      backgroundColor: '#ffffff'
    }
  },
  locales: {
    en: {
      CFBundleDisplayName: 'Name'
    }
  },
  assetBundlePatterns: [
    'assets/*'
  ]
})

My babel.config.ts

module.exports = function (api) {
  api.cache(true)
  return {
    presets: ['babel-preset-expo'],
    plugins: [
      ['@babel/plugin-proposal-optional-chaining'],
      [
        'module-resolver',
        {
          alias: {
            src: './src'
          }
        }
      ]
    ]
  }
}

And my tsconfig.json

{
  "compilerOptions": {
    "target": "ES6",
    "allowSyntheticDefaultImports": true,
    "jsx": "react-native",
    "lib": ["dom", "esnext"],
    "moduleResolution": "node",
    "noEmit": true,
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "strict": true,
    "baseUrl": ".",
    "paths": {
      "src/*": ["src/*"]
    }
  },
  "exclude": ["node_modules"]
}

I keep App.tsx at the root of the directory, and the rest of the code in ./src.

Any idea which direction I can look into? Many thanks!

Found that it is the locales in config wrong somehow.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.