Unable to install expo-cli due to dependency error

Unable to install expo-cli with npm install --global expo-cli

I get the following dependency error:

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! Found: type-fest@0.5.2 npm ERR! node_modules/expo-cli/node_modules/type-fest npm ERR! type-fest@"^0.5.2" from boxen@4.1.0 npm ERR! node_modules/expo-cli/node_modules/boxen npm ERR! boxen@"4.1.0" from expo-cli@4.3.2 npm ERR! node_modules/expo-cli npm ERR! expo-cli@"*" from the root project npm ERR! boxen@"4.1.0" from xdl@59.0.27 npm ERR! node_modules/expo-cli/node_modules/xdl npm ERR! xdl@"59.0.27" from expo-cli@4.3.2 npm ERR! node_modules/expo-cli npm ERR! expo-cli@"*" from the root project npm ERR! 1 more (@expo/dev-tools) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peerOptional type-fest@"^0.13.1" from @pmmmwh/react-refresh-webpack-plugin@0.3.3 npm ERR! node_modules/expo-cli/node_modules/@pmmmwh/react-refresh-webpack-plugin npm ERR! @pmmmwh/react-refresh-webpack-plugin@"^0.3.3" from @expo/webpack-config@0.12.63 npm ERR! node_modules/expo-cli/node_modules/@expo/webpack-config npm ERR! @expo/webpack-config@"0.12.63" from xdl@59.0.27 npm ERR! node_modules/expo-cli/node_modules/xdl npm ERR! xdl@"59.0.27" from expo-cli@4.3.2 npm ERR! node_modules/expo-cli npm ERR! 1 more (@expo/dev-tools) npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Hey @zolly, can you run expo diagnostics and share what’s printed out here?

Cheers,
Adam

@adamjnav I’m unable to run expo diagnostics since I don’t have expo-cli installed. I attempted to install expo globally instead and run expo diagnostics but just got the message “This command requires Expo CLI”

please use npm 6 or follow the instructions from the error message you pasted:

retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

@notbrent --force didn’t work, but --legacy-peer-deps worked out! I also had to use the --legacy-peer-deps command to manually install expo locally in my project after creating a new project with expo init

Thank you!

i have patched the templates to play nicely with npm 7’s behavior - [templates] Update @babel/core dep for npm 7 peer dep issues (expo-cl… · expo/expo@abc0133 · GitHub. you might need to expo init -t blank@latest to get the latest version and skip the cache

1 Like

Looks like expo init is working fine now, thanks!

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