3

I am trying to update an angular-cli/angular 2 project to Angular 4 I updated my package.json with all required angular4 modules and everything seems to go well untill I run the app. When I run the app I get the following error:

Error:

Unable to read property "provide" of undefined.

i've tried everything i can think of: I deleted node_modules and re installed with npm install but still getting the same error... Any idea what could be going wrong here/what I can try to resolve this? i'm using angular-cli 1.0.0.rc-1

my package.json:

{ "name": "Retail-Mobile", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve --proxy-config proxy.conf.json", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^4.0.0", "@angular/common": "^4.0.0", "@angular/compiler": "^4.0.0", "@angular/compiler-cli": "^4.0.0", "@angular/core": "^4.0.0", "@angular/forms": "^4.0.0", "@angular/http": "^4.0.0", "@angular/platform-browser": "^4.0.0", "@angular/platform-browser-dynamic": "^4.0.0", "@angular/platform-server": "^4.0.0", "@angular/router": "^4.0.0", "core-js": "^2.4.1", "moment": "^2.17.1", "ng2-toastr": "^4.0.1", "rxjs": "^5.1.0", "typescript": "^2.2.1", "zone.js": "^0.8.5" }, "devDependencies": { "@angular/cli": "1.0.0-rc.2", "@types/jasmine": "2.5.38", "@types/node": "~6.0.60", "bootstrap": "3.3.7", "codelyzer": "~2.0.0", "jasmine-core": "~2.5.2", "jasmine-spec-reporter": "~3.2.0", "jquery": "3.1.1", "karma": "~1.4.1", "karma-chrome-launcher": "~2.0.0", "karma-cli": "~1.0.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "karma-coverage-istanbul-reporter": "^0.2.0", "protractor": "~5.1.0", "ts-node": "~2.0.0", "tslint": "~4.5.0" } } 
3
  • you are using other modules which depends on angular 2 like ng2-toastr be careful Commented Mar 27, 2017 at 14:13
  • @Bougarfaoui El houcine On the ng2-toast page they specifically state that it's compatible with angular4... Commented Mar 27, 2017 at 14:24
  • The CLI is out of RC now, so think about upgrading that. Also, make sure that all dependent packages are at the latest versions, too. Rxjs, etc. Commented Mar 27, 2017 at 16:49

1 Answer 1

1

Turns out the issue was me forgetting to add a ; at the end of the ng2-toastr import statement... I'm surprised that angular-cli gave me such a vague unhelpful error...

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.