javascript 无法加载“IE”,它没有注册!Karma 上的错误消息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19764243/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 16:43:08  来源:igfitidea点击:

Can not load "IE", it is not registered! error message on Karma

javascriptinternet-explorerunit-testingkarma-runner

提问by Dor Cohen

I'm using karma to run my js tests on multiple browsers. the test works on Chrome & Firefox but I can't activate them on IE.

我正在使用 karma 在多个浏览器上运行我的 js 测试。该测试适用于 Chrome 和 Firefox,但我无法在 IE 上激活它们。

I'm getting the following error message:

我收到以下错误消息:

Can not load "IE", it is not registered! Perhaps you are missing some plugin?

无法加载“IE”,它没有注册!也许你错过了一些插件?

On my config file

在我的配置文件中

SET CHROME_BIN=c:\Program Files (x86)\Google\Chrome\Application\chrome.exe  
SET FIREFOX_BIN=C:\Program Files (x86)\Mozilla Firefox\firefox.exe  
SET IE_BIN=C:\Program Files\Internet Explorer\iexplore.exe  

I also tried this

我也试过这个

SET IE_BIN=C:\Program Files (86)\Internet Explorer\iexplore.exe  

I already installed karma-ie-launcher.

我已经安装了karma-ie-launcher

Can you help me?

你能帮助我吗?

回答by LanderV

In the configuration file for your project (e.g. karma.config.js), check if you have the plugins listed

在您项目的配置文件(例如 karma.config.js)中,检查您是否列出了插件

plugins : [
    'karma-junit-reporter',
    'karma-chrome-launcher',
    'karma-firefox-launcher',
    'karma-opera-launcher',
    'karma-ie-launcher',
    'karma-jasmine'
    ],

回答by Maksood

You have to install the IE launcher, from your project directory where you have installed karma, install ie launcher:

您必须安装 IE 启动器,从您安装 karma 的项目目录中,安装 IE 启动器:

$ npm install karma-ie-launcher

That should create a karma-ie-launcher folder under node_modules(default karma installation folder). Mind that 'plugins:[]' configuration simply instruct Karma what to load, you still have to install the browser launchers if you have not done so in initial Karma installation.

这应该在 node_modules(默认 karma 安装文件夹)下创建一个 karma-ie-launcher 文件夹。请注意,'plugins:[]' 配置只是指示 Karma 加载什么,如果您在初始 Karma 安装中还没有安装浏览器启动器,您仍然需要安装浏览器启动器。

回答by madhured

After installing the karma ie launcher, replace the index.js from the following file

安装 karma ie 启动器后,替换以下文件中的 index.js

https://github.com/karma-runner/karma-ie-launcher/pull/9

https://github.com/karma-runner/karma-ie-launcher/pull/9

Please let me know if it does not work.

如果它不起作用,请告诉我。

回答by Alex

Running karma locally worked for me.

在本地运行业力对我有用。

./node_modules/karma/bin/karma start

./node_modules/karma/bin/karma start

回答by George

Amend Package.Json

修改 Package.Json

I had a similar problem with Chrome. After setting the environment variables as you did, what eventually worked was ensuring the following following entries with the specified version numbers in the package.json's devDependencies:

我在 Chrome 上遇到了类似的问题。像您一样设置环境变量后,最终起作用的是确保以下条目在 package.json 的 devDependencies 中具有指定的版本号:

"karma-jasmine": "~0.2.2",
"karma-chrome-launcher": "~0.1.2",

Then perform:

然后执行:

npm update

回答by Ema.jar

I'm currently using npm to manage packages and plugins, so I don't know if the steps I followed are the same for you. I see that your question is two years old, I'm currently working on Karma 0.13.15.

我目前正在使用npm来管理包和插件,所以不知道我遵循的步骤是否与您相同。我看到你的问题已经两年了,我目前正在研究 Karma 0.13.15。

Basically to solve this problem I've performed

基本上是为了解决这个问题,我已经执行了

npm install karma-ie-launcher --save-dev -save

This command can be used to download the IE launcher plugin and update karma.config.js.

此命令可用于下载 IE 启动器插件和更新 karma.config.js。

You can find a list of all launchers here: https://www.npmjs.com/package/karma-ie-launcher

您可以在此处找到所有启动器的列表:https: //www.npmjs.com/package/karma-ie-launcher

回答by M.K. Safi

Try wrapping your paths in quotes, e.g.:

尝试将您的路径用引号括起来,例如:

SET IE_BIN="C:\Program Files (86)\Internet Explorer\iexplore.exe"

Also, make sure you've installed and configured Karma IE launcher.

此外,请确保您已安装并配置Karma IE 启动器