I'm getting an error when I run karma start
:
$ karma start
INFO [karma]: Karma v0.10.2 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
WARN [preprocess]: Can not load "ng-html2js", it is not registered!
Perhaps you are missing some plugin?
...
But in my package file I have "karma-ng-html2js-preprocessor": "*",
and the folder with code for this preprocessor exists in node_modules
.
Any ideas on how to solve the problem?
In my cases, the problem was connected to lack of karma-ng-html2js-preprocessor
inside karma config plugins
sections. In tutorials I saw that you don't need to add 'ng-html2js'
inside plugins, but for me it doesn't work without it.
If you are starting and running a global install of Karma, one that's installed with -g
flag, and is run without specifying a path, i.e. karma start path/to/config.js
, then make sure the plugins are also globally installed, i.e. npm install -g karma-ng-html2js-preprocessor
.
If you're running a local install of Karma, i.e. path/to/karma start path/to/config.js
then make sure plugin is also installed locally to that application.
Check out Loading Plugins in the docs.
If you omit the plugins
property, it'll try to load all the plugins that are:
karma-
.karma
npm module.So if your file structure is:
- node_modules
- karma
- karma-chrome-launcher
- karma-firefox-launcher
...since karma-chrome-launcher
and karma-firefox-launcher
are siblings to the karma
module that is in use, and since they both start with karma-
they'll be loaded automatically.
But be careful - if you do have the plugins
property defined, it'll only load the things that are defined. Ie. if you have plugins: ['karma-chrome-launcher']
, it won't load karma-firefox-launcher
.
Some questions to ask yourself:
karma
or a global version?npm update
or npm uninstall
-> npm install
.karma-x
that are overriding the local ones?If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With