expo camera doesn't install

Getting this error whine trying to install expo-camera

Installing 1 SDK 40.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! Found: @unimodules/core@6.0.0
npm ERR! node_modules/@unimodules/core
npm ERR!   @unimodules/core@"~6.0.0" from expo@40.0.0
npm ERR!   node_modules/expo
npm ERR!     expo@"~40.0.0" from the root project
npm ERR!   peer @unimodules/core@"*" from expo-application@2.4.1
npm ERR!   node_modules/expo-application
npm ERR!     expo-application@"~2.4.1" from expo@40.0.0
npm ERR!     node_modules/expo
npm ERR!       expo@"~40.0.0" from the root project
npm ERR!   1 more (expo-location)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @unimodules/core@"~5.1.2" from expo-camera@9.1.0
npm ERR! node_modules/expo-camera
npm ERR!   expo-camera@"~9.1.0" 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 /home/muaz/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/muaz/.npm/_logs/2020-12-12T16_45_39_635Z-debug.log

npm exited with non-zero code: 1
Error: npm exited with non-zero code: 1
    at ChildProcess.completionListener (/usr/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
    at Object.onceWrapper (node:events:483:26)
    at ChildProcess.emit (node:events:376:20)
    at maybeClose (node:internal/child_process:1055:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
    ...
    at Object.spawnAsync [as default] (/usr/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
    at NpmPackageManager._runAsync (/usr/lib/node_modules/expo-cli/node_modules/@expo/package-manager/src/NodePackageManagers.ts:157:31)
    at NpmPackageManager.addAsync (/usr/lib/node_modules/expo-cli/node_modules/@expo/package-manager/src/NodePackageManagers.ts:100:18)
    at installAsync (/usr/lib/node_modules/expo-cli/src/commands/install.ts:129:3)
    at Command.<anonymous> (/usr/lib/node_modules/expo-cli/src/exp.ts:346:7)

Hey @mmuaz, I just created a new bare project and installed expo-camera without issue. I would recommend deleting your node_modules, clearing your caches and then trying to install it again.

Cheers,
Adam

nothing worked

Is this in an existing project or a new one?

I normally use yarn, but tried it with npm now, since that’s what you’re using:

$ expo init test --npm
✔ Choose a template: › blank                 a minimal app as clean as an empty canvas
✔ Downloaded and extracted project files.

📦 Using npm to install packages.

✔ Installed JavaScript dependencies.

✅ Your project is ready!

To run your project, navigate to the directory and run one of the following npm commands.

- cd test
- npm start # you can open iOS, Android, or web from here, or run them directly with the commands below.
- npm run android
- npm run ios # requires an iOS device or macOS for access to an iOS simulator
- npm run web
$ cd test
$ expo install expo-camera
Installing 1 SDK 40.0.0 compatible native module using npm.
> npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 3 packages from 3 contributors and audited 912 packages in 10.234s

21 packages are looking for funding
  run `npm fund` for details

found 9 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details


   ╭────────────────────────────────────────────────────────────────╮
   │                                                                │
   │      New patch version of npm available! 6.14.8 → 6.14.9       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.14.9   │
   │               Run npm install -g npm to update!                │
   │                                                                │
   ╰────────────────────────────────────────────────────────────────╯


$ 

in existing project. i tried creating 6,7 projects from start but always get this error

Something weird is going on there. It looks as if npm is not able to find the right version of @unimodules/core.

Can you run expo diagnostics and post the output?

Maybe upgrading/downgrading nodejs would help.
Maybe trying yarn instead of npm would help.

are you using npm 7?

also, i published an update to expo-camera earlier today which made the peer dependency more lenient as i believe this might have happened to another npm 7 user: [expo-camera] Change @unimodules/core peer dependency to * · expo/expo@169523c · GitHub

so you definitely should not be getting a warning about @unimodules/core@5.1.2 anymore, and the expo-camera version that is getting installed should be 9.1.1

Expo CLI 4.0.11 environment info: System: OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa) Shell: 5.0.17 - /bin/bash Binaries: Node: 15.3.0 - /usr/bin/node npm: 7.0.14 - /usr/bin/npm 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.1.tar.gz => 0.63.2 react-native-web: ~0.13.12 => 0.13.18 npmGlobalPackages: expo-cli: 4.0.11 Expo Workflow: managed

I’m using npm 7.0.14. It suddenly started working. I don’t know what is the reason. It works sometime but most of the time i’m getting the error i posted earlier.

I believe that the reason it works now is because of the updated version of expo-camera that @notbrent published.

alright… but what to do if it stopped working in future project.

Complain on the forums again. Or on the GitHub issue tracker if you can give all the details about the circumstances like OS, version of nodejs, version of npm, version of expo-cli, etc.
:slight_smile:

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