expo: npx expo install --fix fails with TypeError: Cannot read properties of undefined (reading '0')

Summary

Trying to upgrade Expo SDK from 47.0.12 to 48.0.0, ran the steps following the blog entry here https://blog.expo.dev/expo-sdk-48-ccb8302e231

Getting the following error when running npx expo install --fix

PS C:\mobile\test> npx expo install --fix
Some dependencies are incompatible with the installed expo version:
  expo-apple-authentication@5.0.1 - expected version: ~6.0.1  
  expo-application@5.0.1 - expected version: ~5.1.1
  expo-auth-session@3.8.0 - expected version: ~4.0.3
  expo-barcode-scanner@12.1.0 - expected version: ~12.3.2     
  expo-dev-client@2.0.1 - expected version: ~2.1.5
  expo-device@5.0.0 - expected version: ~5.2.1
  expo-font@11.0.1 - expected version: ~11.1.1
  expo-linear-gradient@12.0.1 - expected version: ~12.1.2     
  expo-linking@3.3.0 - expected version: ~4.0.1
  expo-local-authentication@13.0.2 - expected version: ~13.2.1
  expo-location@15.0.1 - expected version: ~15.1.1
  expo-notifications@0.17.0 - expected version: ~0.18.1       
  expo-random@13.0.0 - expected version: ~13.1.1
  expo-secure-store@12.0.0 - expected version: ~12.1.1        
  expo-splash-screen@0.17.5 - expected version: ~0.18.1       
  expo-status-bar@1.4.2 - expected version: ~1.4.4
  expo-web-browser@12.0.0 - expected version: ~12.1.1
  react@18.1.0 - expected version: 18.2.0
  react-dom@18.1.0 - expected version: 18.2.0
  react-native@0.70.5 - expected version: 0.71.3
  react-native-gesture-handler@2.8.0 - expected version: ~2.9.0
  react-native-pager-view@6.0.1 - expected version: 6.1.2
  react-native-reanimated@2.12.0 - expected version: ~2.14.4
  react-native-safe-area-context@4.4.1 - expected version: 4.5.0
  react-native-screens@3.18.2 - expected version: ~3.20.0
  react-native-webview@11.23.1 - expected version: 11.26.0
Your project may not work correctly until you install the correct versions of the packages.
Install individual packages by running npx expo install expo-apple-authentication@~6.0.1 expo-application@~5.1.1 expo-auth-session@~4.0.3 expo-barcode-scanner@~12.3.2 expo-dev-client@~2.1.5 expo-device@~5.2.1 expo-font@~11.1.1 expo-linear-gradient@~12.1.2 expo-linking@~4.0.1 expo-local-authentication@~13.2.1 expo-location@~15.1.1 expo-notifications@~0.18.1 expo-random@~13.1.1 expo-secure-store@~12.1.1 expo-splash-screen@~0.18.1 expo-status-bar@~1.4.4 expo-web-browser@~12.1.1 react@18.2.0 react-dom@18.2.0 react-native@0.71.3 react-native-gesture-handler@~2.9.0 react-native-pager-view@6.1.2 react-native-reanimated@~2.14.4 react-native-safe-area-context@4.5.0 react-native-screens@~3.20.0 react-native-webview@11.26.0
› Installing 26 SDK 48.0.0 compatible native modules using npm
TypeError: Cannot read properties of undefined (reading '0')
TypeError: Cannot read properties of undefined (reading '0')
    at npa (C:\mobile\test\node_modules\npm-package-arg\npa.js:34:25)
    at npa (C:\mobile\test\node_modules\npm-package-arg\npa.js:31:14)
    at C:\mobile\test\node_modules\@expo\package-manager\build\NodePackageManagers.js:145:58
    at Array.map (<anonymous>)
    at NpmPackageManager._parseSpecs (C:\mobile\test\node_modules\@expo\package-manager\build\NodePackageManagers.js:145:14)
    at NpmPackageManager.addWithParametersAsync (C:\mobile\test\node_modules\@expo\package-manager\build\NodePackageManagers.js:69:49)
    at NpmPackageManager.addAsync (C:\mobile\test\node_modules\@expo\package-manager\build\NodePackageManagers.js:84:20)
    at Object.fixPackagesAsync (C:\mobile\test\node_modules\@expo\cli\build\src\install\installAsync.js:105:30)
    at Object.checkPackagesAsync (C:\mobile\test\node_modules\@expo\cli\build\src\install\checkPackages.js:61:35)
    at async installAsync (C:\mobile\test\node_modules\@expo\cli\build\src\install\installAsync.js:56:16)

Node Version: v18.15.0

NPM Version: 9.5.0

I am using eas builds and eas cli is installed globally, not inside the repo.

Tried reinstalling node and npm, cleaned all cache, and started from scratch, still the same error. Any help is appreciated.

What platform(s) does this occur on?

Android, iOS

SDK Version

48

Environment

    System:
      OS: Windows 10 10.0.19045
    Binaries:
      Node: 18.15.0 - C:\Program Files\nodejs\node.EXE
      npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
    IDEs:
      Android Studio: AI-221.6008.13.2211.9477386
    npmPackages:
      expo: ^48.0.0 => 48.0.0
      react: 18.1.0 => 18.1.0
      react-dom: 18.1.0 => 18.1.0
      react-native: 0.70.5 => 0.70.5
      react-native-web: ~0.18.9 => 0.18.12
    Expo Workflow: managed

Minimal reproducible example

none

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 11
  • Comments: 21 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I was encountering this issue too. I tried:

  • updating to latest node.js and npm (18.15 and 9.5.0 respectively)
  • npm -g uninstall expo-cli --save
  • npm cache clear --force

None of these resolved the issue. What worked for me finally was downgrading to 48.0.6 as per @rook218 and @prateek-somaiya

npm install expo@48.0.6

I have this Node Version: 18.15.0 NPM Version: 9.5.0

@prateek-somaiya try updating npm version and clear cache, it helped me at least

@NasirAziz I did, actually that’s the first thing I did! I even uninstalled nodejs and npm completely, removed all the directories and everything. Re-installed everything from scratch, like the LTS nodejs version and the npm which comes with it. Didn’t update npm beyond 9.5.0, moreover, this has definitely something to do with the expo sdk version because I downgraded to 48.0.6 and that works fine! I think while upgrading it was taking me to 48.0.17, can’t recall…

Thank you, installing npm install expo@48.0.6 solved my issue. Must be something with the highest minor version of expo.

node version v14.15.4 npm version 6.14.10

My full stacktrace:

› Installing 12 SDK 48.0.0 compatible native modules using npm
TypeError: Cannot read property '0' of undefined
TypeError: Cannot read property '0' of undefined
    at npa (C:\repos\budget-app\node_modules\npm-package-arg\npa.js:34:25)
    at npa (C:\repos\budget-app\node_modules\npm-package-arg\npa.js:31:14)
    at C:\repos\budget-app\node_modules\@expo\package-manager\build\NodePackageManagers.js:145:58
    at Array.map (<anonymous>)
    at NpmPackageManager._parseSpecs (C:\repos\budget-app\node_modules\@expo\package-manager\build\NodePackageManagers.js:145:14)
    at NpmPackageManager.addWithParametersAsync (C:\repos\budget-app\node_modules\@expo\package-manager\build\NodePackageManagers.js:69:49)
    at NpmPackageManager.addAsync (C:\repos\budget-app\node_modules\@expo\package-manager\build\NodePackageManagers.js:84:20)
    at Object.fixPackagesAsync (C:\repos\budget-app\node_modules\@expo\cli\build\src\install\installAsync.js:105:30)
    at Object.checkPackagesAsync (C:\repos\budget-app\node_modules\@expo\cli\build\src\install\checkPackages.js:61:35)
    at async installAsync (C:\repos\budget-app\node_modules\@expo\cli\build\src\install\installAsync.js:56:16)

I have this Node Version: 18.15.0 NPM Version: 9.5.0

@prateek-somaiya try updating npm version and clear cache, it helped me at least

@NasirAziz I did, actually that’s the first thing I did! I even uninstalled nodejs and npm completely, removed all the directories and everything. Re-installed everything from scratch, like the LTS nodejs version and the npm which comes with it. Didn’t update npm beyond 9.5.0, moreover, this has definitely something to do with the expo sdk version because I downgraded to 48.0.6 and that works fine! I think while upgrading it was taking me to 48.0.17, can’t recall…

thanks installing expo 48.0.6 fixed the issue

thanks for raising this issue. I resolved this by installing the latest version ‘npm i expo’, rather than following the blog post to upgrade to 48.0.0

Closing this as the package manager has been refactored, during which this issue was fixed. You could run into the issue if you are installing expo@48.0.0, you can update to the working version by using npm install expo@^48.0.6 && npx expo install --fix (as mentioned above)

npm install expo@48.0.6

Same as @epten08, upgrading npm/node solved nothing, but expo@48.0.6 made it through.

For what it’s worth, I was on expo@48.0.0 as I was following the blog post instructions on updating to sdk 48.

I solved the issue, first of all global expo-cli is a lagacy, for SDK46 and above you have to use the Local Expo CLI , just run the following: npm -g uninstall expo-cli --save ,

This is a major blocker because even after installing the correct package versions manually via npm the problem persists… Trying to install anything using npx expo install <package> just fails with the same error.