TypeError: providers [name] [0] is not a feature of Angular 4.0.1 npm test

Hi I'm new to Angular2, and when I try to run npm test with examples on the official angular.io site, I get this error:

providers[name][0] is not a function
TypeError: providers[name][0] is not a function
    at get (/Users/marcpursals/repos/..../node_modules/di/lib/injector.js:48:43)
    at /Users/marcpursals/repos/...../node_modules/di/lib/injector.js:71:14
    at Array.map (native)
    at Injector.invoke (/Users/marcpursals/repos/...../node_modules/di/lib/injector.js:70:31)
    at Server.start (/Users/marcpursals/repos/....node_modules/karma/lib/server.js:103:18)
    at Promise (/Users/marcpursals/repos/..../node_modules/@angular/cli/tasks/test.js:35:25)
    at Class.run (/Users/marcpursals/repos/..../node_modules/@angular/cli/tasks/test.js:15:16)
    at Class.run (/Users/marcpursals/repos/....node_modules/@angular/cli/commands/test.js:99:25)
    at Class.<anonymous> (/Users/marcpursals/repos/...../node_modules/@angular/cli/ember-cli/lib/models/command.js:134:17)
    at process._tickCallback (internal/process/next_tick.js:103:7)
npm ERR! Test failed.  See above for more details.

      

I am using angular 4.0.1 and my package.json is as follows:

"dependencies": {
    "@angular/animations": "^4.0.1",
    "@angular/common": "^4.0.1",
    "@angular/compiler": "^4.0.1",
    "@angular/compiler-cli": "^4.0.1",
    "@angular/core": "^4.0.1",
    "@angular/forms": "^4.0.1",
    "@angular/http": "^4.0.1",
    "@angular/material": "^2.0.0-beta.2",
    "@angular/platform-browser": "^4.0.1",
    "@angular/platform-browser-dynamic": "^4.0.1",
    "@angular/platform-server": "^4.0.1",
    "@angular/router": "^4.0.1",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.22",
    "@types/d3": "^4.5.0",
    "@types/jasmine": "^2.5.47",
    "@types/lodash": "^4.14.50",
    "@types/node": "^6.0.68",
    "bootstrap": "^4.0.0-alpha.6",
    ...
    "jasmine-spec-reporter": "^2.7.0",
    "jquery": "^3.1.1",
    ...
    "karma": "^1.5.0",
    "karma-jasmine": "^1.1.0",
    "karma-remap-istanbul": "^0.2.2",
    "lodash": "^4.17.4",
    ....
    "typescript": "^2.2.2",
    "zone.js": "^0.8.4"
  },

      

I tried to do this but I couldn't find a clue. Has anyone faced the same problem?

+3


source to share


1 answer


check yours karma.conf.js file

: in the plugin field you have to point directly to karma, but the karma plugin in@angular/cli/plugins



0


source







All Articles