@ionic-native/camera has missing dependencies

Error: The target entry-point “@ionic-native/camera” has missing dependencies:

This is the error I get after installing the plugin in an Ionic project

Ionic 5
Using Cordova 9.1.0

How can I solve this?

It would probably help to know what the missing dependencies are reported to be.

This is the error

ng.cmd run app:serve --host=localhost --port=8101
[ng] - Generating browser application bundles…
[ng] C:\Users\Kent\projects\mobile\kejanext\node_modules@angular\compiler-cli\ngcc\src\entry_point_finder\targeted_entry_point_finder.js:40
[ng] throw new Error(“The target entry-point “” + invalidTarget.entryPoint.name + “” has missing dependencies:\n” +
[ng] ^
[ng] Error: The target entry-point “@ionic-native/camera” has missing dependencies:
[ng] - @ionic-native/core
[ng] at TargetedEntryPointFinder.findEntryPoints (C:\Users\Kent\projects\mobile\kejanext\node_modules@angular\compiler-cli\ngcc\src\entry_point_finder\targeted_entry_point_finder.js:40:23)
[ng] at C:\Users\Kent\projects\mobile\kejanext\node_modules@angular\compiler-cli\ngcc\src\execution\analyze_entry_points.js:29:41
[ng] at SingleProcessExecutorSync.SingleProcessorExecutorBase.doExecute (C:\Users\Kent\projects\mobile\kejanext\node_modules@angular\compiler-cli\ngcc\src\execution\single_process_executor.js:28:29)
[ng] at C:\Users\Kent\projects\mobile\kejanext\node_modules@angular\compiler-cli\ngcc\src\execution\single_process_executor.js:57:59
[ng] at SyncLocker.lock (C:\Users\Kent\projects\mobile\kejanext\node_modules@angular\compiler-cli\ngcc\src\locking\sync_locker.js:34:24)
[ng] at SingleProcessExecutorSync.execute (C:\Users\Kent\projects\mobile\kejanext\node_modules@angular\compiler-cli\ngcc\src\execution\single_process_executor.js:57:27)
[ng] at Object.mainNgcc (C:\Users\Kent\projects\mobile\kejanext\node_modules@angular\compiler-cli\ngcc\src\main.js:74:25)
[ng] at Object.process (C:\Users\Kent\projects\mobile\kejanext\node_modules@angular\compiler-cli\ngcc\index.js:29:23)
[ng] at NgccProcessor.processModule (C:\Users\Kent\projects\mobile\kejanext\node_modules@ngtools\webpack\src\ngcc_processor.js:164:16)[ng] at C:\Users\Kent\projects\mobile\kejanext\node_modules@ngtools\webpack\src\ivy\host.js:128:18

[ERROR] ng has unexpectedly closed (exit code 1).

    The Ionic CLI will exit. Please check any output above for error details.

try running npm install @ionic-native/core

1 Like

Thanks, issue solved.

Yes, I did it , but why?
Why ionic-native/core is missing or why we must use it if it’missing?

Ionic native plugins have a peerDependency to @ionic-native/core.

peerDependency is used to avoid conflicts when people have multiple ionic-native plugins with different versions, if they had @ionic-native/core as a dependency some of them might fail to install or even work correctly if they required different @ionic-native/core versions each.

By using a peerDependency instead of npm automatically installing the dependency, the responsibility lies with the user who installs the plugin. If the dependency is already installed, nothing will happen, if the dependency is missing, then npm warns that the peer dependency is missing.

Well, actually if using npm 7, it will also install the peer dependencies if possible, so your issue should go away.

I’m sort of surprised this would work. Can you install multiple versions of the same package (specifically @ionic/core, if that matters) alongside one another without them conflicting with one another?

In the past each dependency inside node_modules had its own node_modules folder inside the package folder with all its dependencies installed.

Nowadays, not sure in which version of npm it started doing this, there is only one dependency installed on the root of node_modules, and that’s where the conflicts come in as only one package is installed and some other package might want a different version from the one installed.

1 Like

I always tell people to align the major version of every piece of @ionic-native/* in their projects. Until I hear officially otherwise, I think I’m going to stick with that advice.