Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: NullInjectorError: No provider for Dr! #7816

Open
2 of 3 tasks
israeloriente opened this issue Dec 23, 2024 · 6 comments
Open
2 of 3 tasks

[Bug]: NullInjectorError: No provider for Dr! #7816

israeloriente opened this issue Dec 23, 2024 · 6 comments
Labels

Comments

@israeloriente
Copy link

Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 6.2.0
@capacitor/core: 6.2.0
@capacitor/android: 6.2.0
@capacitor/ios: 6.2.0

Installed Dependencies:

@capacitor/ios: not installed
@capacitor/cli: 6.2.0
@capacitor/android: 6.2.0
@capacitor/core: 6.2.0

[success] Android looking great! 👌

Other API Details

npm -v -> v10.5.0
node -v -> v20.9.0

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

I am getting an error when initializing a blank project with Capacitor. The error only occurs with Angular (version 19 used), and it is affecting Capacitor iOS and Android with the message:

File: https://localhost/ - Line 816 - Msg: NullInjectorError: R3InjectorError(Platform: core)[t -> Dr]:
NullInjectorError: No provider for Dr!
2024-12-23 19:03:52.363 7366-7366 Capacitor io.ionic.starter E JavaScript Error: {"type":"js.error","error":{"message":"Uncaught NullInjectorError: R3InjectorError(Platform: core)[t -> Dr]: \n NullInjectorError: No provider for Dr!","url":"https://localhost/main.039eac01c0536d9c.js","line":1,"col":130576,"errorObject":"{\"name\":\"NullInjectorError\",\"ngTempTokenPath\":null,\"ngTokenPath\":[\"t\",\"Dr\"]}"}}
2024-12-23 19:03:52.364 7366-7366 Capacitor/Console io.ionic.starter E File: https://localhost/main.039eac01c0536d9c.js - Line 1 - Msg: Uncaught NullInjectorError: R3InjectorError(Platform: core)[t -> Dr]:
NullInjectorError: No provider for Dr!

Expected Behavior

The application was expected to open normally, but the screen stays completely white, with an error message in the logs.

Project Reproduction

ionic start -> Framework Angular -> npm i @capacitor/android -> npx cap add android -> npm run build -> npx cap copy -> npx cap open android

Additional Information

No response

@stevenjos27
Copy link

Having the same issue here for newly created project, capacitor and angular version same as @israeloriente. Getting the same error on multiple machines

@JustinKScott
Copy link

Same for me. Affects both Android and IOS.

Angular using Modules results in this error.
-- Vue and Angular Standalone runs correctly on both Android and IOS simulators.

IOS output error:

⚡️ ------ STARTUP JS ERROR ------

⚡️ NullInjectorError: R3InjectorError(Platform: core)[t -> Dr]:
NullInjectorError: No provider for Dr!
⚡️ URL: capacitor://localhost/main.6d3c5ad0b36e3fa3.js
⚡️ main.6d3c5ad0b36e3fa3.js:1:134639

@DiscoDurodeRoer
Copy link

Change angular version from 19 to 18 works.

"dependencies": {
"@angular/animations": "^18.0.0",
"@angular/common": "^18.0.0",
"@angular/compiler": "^18.0.0",
"@angular/core": "^18.0.0",
"@angular/forms": "^18.0.0",
"@angular/platform-browser": "^18.0.0",
"@angular/platform-browser-dynamic": "^18.0.0",
"@angular/router": "^18.0.0",
"@capacitor/app": "6.0.2",
"@capacitor/core": "6.2.0",
"@capacitor/haptics": "6.0.2",
"@capacitor/ios": "6.2.0",
"@capacitor/keyboard": "6.0.3",
"@capacitor/status-bar": "6.0.2",
"@ionic/angular": "^8.0.0",
"ionicons": "^7.0.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.0.0",
"@angular-eslint/builder": "^18.0.0",
"@angular-eslint/eslint-plugin": "^18.0.0",
"@angular-eslint/eslint-plugin-template": "^18.0.0",
"@angular-eslint/schematics": "^18.0.0",
"@angular-eslint/template-parser": "^18.0.0",
"@angular/cli": "^18.0.0",
"@angular/compiler-cli": "^18.0.0",
"@angular/language-service": "^18.0.0",
"@capacitor/cli": "6.2.0",
"@ionic/angular-toolkit": "^12.0.0",
"@types/jasmine": "~5.1.0",
"@typescript-eslint/eslint-plugin": "^8.18.0",
"@typescript-eslint/parser": "^8.18.0",
"eslint": "^9.16.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.2.1",
"eslint-plugin-prefer-arrow": "1.2.2",
"jasmine-core": "~5.1.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.4.0"
}

@JustinKScott
Copy link

Change angular version from 19 to 18 works.

WOOT! Confirmed downgrading from 19 -> 18 resolves the issue on both Android and IOS!

@vikas-diatoz
Copy link

Thank you it's working after changing Angular version from 19 to 18

@bonbj
Copy link

bonbj commented Jan 4, 2025

Thank you, I have a same problem, solve with Angular 18 and npm install --force

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants