Angularjs 错误:找不到模块';茉莉期待';[量角器]

Angularjs 错误:找不到模块';茉莉期待';[量角器],angularjs,selenium-webdriver,npm,protractor,git-bash,Angularjs,Selenium Webdriver,Npm,Protractor,Git Bash,我正在尝试运行一个量角器测试,它只连接到我的应用程序 当我运行(git bash/terminal)时: 我收到以下错误: 错误:找不到模块“jasmine expect” 看到这一点后,我继续安装模块: npm install -g jasmine-expect 但我仍然受到同样的失败 这是我的测试: describe('DragAndDrop Test', function () { require('protractor'); require('jasmine-expect'); b

我正在尝试运行一个量角器测试,它只连接到我的应用程序

当我运行(git bash/terminal)时:

我收到以下错误:

错误:找不到模块“jasmine expect”

看到这一点后,我继续安装模块:

npm install -g jasmine-expect
但我仍然受到同样的失败

这是我的测试:

describe('DragAndDrop Test', function () {
require('protractor');
require('jasmine-expect');


beforeAll(function () {
    context = new Context();
    context.get();
    browser.waitForAngular();
    browser.driver.manage().window().maximize();
});

it('should drag and drop Application Experience tile', function () {

    //target is where we are dragging the box to.  Box is the Box
    var target = { x: 300, y: 50 };
    var box = element(by.cssContainingText('h3', 'Application Experience'));

    //scope is going to hold the scope variables that tell us where the box is located
    //get the standardItems Scope

    box.evaluate('dashboards').then(function(scope) {
        //make sure the box we are using is initially set in column 0 and Row 0
        expect(scope['1'].widgets[0].col).toEqual(0);
        expect(scope['1'].widgets[0].row).toEqual(0);
    });

    //drag and drop the box somewhere else.
    browser.actions().dragAndDrop(box, target).perform();
    browser.waitForAngular();
    browser.driver.sleep(5000);

    //get the updated scope
    box.evaluate('dashboards').then(function(scope) {
        //test to see that the box was actually moved to column 1 and row 0
        expect(scope['1'].widgets[0].col).toEqual(1);
        expect(scope['1'].widgets[0].row).toEqual(0);
    });
});

});

var Context = function () {
this.ignoreSynchronization = true;
    //load the website
    this.get = function () {
        browser.get('http://127.0.0.1:62734/index.html#/dashboard');
    };
};
这是我的conf.js:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['gridster-Test.js'],
    capabilities: {
    browserName: 'firefox'
   }
};

有什么建议吗?

首先,尝试在不使用
-g
标志的情况下安装软件包:

npm install jasmine-expect
另外,将
require('jasmine-expect');
description
下移动到量角器配置文件中的
onPrepare()

onPrepare: function () {
    require("jasmine-expect");
},

确保正在将依赖项添加到package.json文件中

npm install jasmine-expect --save-dev 

除了您建议的onPrepare()之外,还尝试了在没有-g标志的情况下安装。相同的错误消息。它找不到jasmine expect。它已成功安装,因此我不知道发生了什么。
npm install jasmine-expect --save-dev