1

I am attempting to download @react-native-community/slider using expo. Doing this fails

Expo version: 4.12.10 NPM version: lastest(8.1.2)

I've read that you are supposed to add --legacy-peer-deps on https://github.com/callstack/react-native-slider/issues/333

However, you cannot do this with expo.

Logs of powershell output

PS C:\Users\15154\Downloads\Projects\demo> npm install -g npm@latest
C:\Users\15154\AppData\Roaming\npm\npm -> C:\Users\15154\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
C:\Users\15154\AppData\Roaming\npm\npx -> C:\Users\15154\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js
+ [email protected]
added 70 packages from 18 contributors, removed 289 packages and updated 148 packages in 20.49s


   ╭───────────────────────────────────────────────────────────────╮
   │                                                               │
   │     New major version of npm available! 6.14.15 -> 8.1.2      │
   │   Changelog: https://github.com/npm/cli/releases/tag/v8.1.2   │
   │               Run npm install -g npm to update!               │
   │                                                               │
   ╰───────────────────────────────────────────────────────────────╯

PS C:\Users\15154\Downloads\Projects\demo> npm -v
8.1.2
PS C:\Users\15154\Downloads\Projects\demo> expo install @react-native-community/slider
Installing 1 SDK 43.0.0 compatible native module using npm.
> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"17.0.1" from the root project
npm ERR!   peer react@"*" from @react-native-community/[email protected]
npm ERR!   node_modules/@react-native-community/slider
npm ERR!   1 more (react-native)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.2" from [email protected]
npm ERR! node_modules/react-native-windows
npm ERR!   peer react-native-windows@"*" from @react-native-community/[email protected]
npm ERR!   node_modules/@react-native-community/slider
npm ERR!     @react-native-community/slider@"4.1.7" from the root project
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.
npm ERR!
npm ERR! See C:\Users\15154\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\15154\AppData\Local\npm-cache\_logs\2021-10-31T23_22_12_319Z-debug.log

npm exited with non-zero code: 1
Error: npm exited with non-zero code: 1
    at ChildProcess.completionListener (C:\Users\15154\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:65:13)
    at Object.onceWrapper (node:events:510:26)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.cp.emit (C:\Users\15154\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
    ...
    at Object.spawnAsync [as default] (C:\Users\15154\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:26:19)
    at NpmPackageManager._runAsync (C:\Users\15154\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\package-manager\src\NodePackageManagers.ts:166:31)
    at NpmPackageManager.addAsync (C:\Users\15154\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\package-manager\src\NodePackageManagers.ts:105:18)
    at actionAsync (C:\Users\15154\AppData\Roaming\npm\node_modules\expo-cli\src\commands\installAsync.ts:122:3)

Help would be greatly appriciated

1 Answer 1

0

Install NPM package first and then used expo command:

npm i --save @react-native-community/slider --legacy-peer-deps
expo install @react-native-community/slider

Looks like this worked for me.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.