angular-phonecat icon indicating copy to clipboard operation
angular-phonecat copied to clipboard

npm run protractor step fails on windows

Open gdadams123 opened this issue 12 years ago • 12 comments

Running via cygwyn on windows: $ npm run protractor

[email protected] preprotractor C:\git\angular-phonecat npm run update-webdriver

[email protected] preupdate-webdriver C:\git\angular-phonecat npm install

[email protected] postinstall C:\git\angular-phonecat bower install

[email protected] update-webdriver C:\git\angular-phonecat webdriver-manager update

selenium standalone is up to date. chromedriver is up to date.

[email protected] protractor C:\git\angular-phonecat protractor test/protractor-conf.js

Using ChromeDriver directly...

C:\git\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\net\index.js:48 interfaces[key].forEach(function(ipAddress) { ^

npm ERR! [email protected] protractor: protractor test/protractor-conf.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] protractor script. npm ERR! This is most likely a problem with the angular-phonecat package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! protractor test/protractor-conf.js npm ERR! You can get their info via: npm ERR! npm owner ls angular-phonecat npm ERR! There is likely additional logging output above. npm ERR! System Windows_NT 6.2.9200 npm ERR! command "C:\nodejs\node.exe" "C:\nodejs\node_modules\npm\bin\npm-cli.js" "run" "protractor" npm ERR! cwd C:\git\angular-phonecat npm ERR! node -v v0.10.29 npm ERR! npm -v 1.4.14 npm ERR! code ELIFECYCLE npm

gdadams123 avatar Jun 20 '14 15:06 gdadams123

that same command is failing for me on mac os 10.9, in step 3.

jkschwartz avatar Jun 21 '14 00:06 jkschwartz

I have the same error on Windows 7 32 bit version.

eduardobape avatar Jun 23 '14 16:06 eduardobape

This is actually a protractor issue. @gdadams123 @eduardobape the solution is running the selenium as a standalone server and configuring the protractor-conf.js. I used to have the same issue in Windows 8.1 with Chrome browser. In more details this has already been discussed in angular / protractor issues, issue #906 @awhitesuit I'm not sure this also works for Mac but probably does, so I suggest you check it too.

avadolas avatar Jun 23 '14 17:06 avadolas

Thanks for your help @avadolas. The solution for me is the following. In angular-phonecat\test\protractor-conf.js file, I have changed the line chromeOnly: true for this one: chromeOnly: false. After this, the npm run protractor command works correctly.

eduardobape avatar Jun 24 '14 15:06 eduardobape

I am trying to run through the tutorial and am also encountering this. If the issue is going to be persistent, it would be nice to see the tutorial mention something about it so new users are not off-put by a failure so early on.

adamvoss avatar Jul 01 '14 16:07 adamvoss

Hi guys, I suffered from this same issue, on windows 7 64bit & windows 7 32bit,

I solved the issue by updating the version of protractor and karma in the package.json to the latest versions and explicitly adding the karma-cli package... which is a tad undocumented or at least not obviously doc-ed

Guessing it must be a bug in protractor on windows 7 resolve in the latest version.

->

"karma": "^0.12.16",
"karma-cli": "^0.0.4",
"protractor": "^1.0.0-rc",

eg so package json was

{
  "version": "0.0.0",
  "private": true,
  "name": "angular-phonecat",
  "description": "A tutorial application for AngularJS",
  "repository": "https://github.com/angular/angular-phonecat",
  "license": "MIT",
  "devDependencies": {
    "karma": "^0.12.16",
    "karma-cli": "^0.0.4",
    "protractor": "^1.0.0-rc",
    "http-server": "^0.6.1",
    "bower": "^1.3.1",
    "shelljs": "^0.2.6"
  },
  "scripts": {
    "postinstall": "bower install",

    "prestart": "npm install",
    "start": "http-server -p 8000",

    "pretest": "npm install",
    "test": "karma start test/karma.conf.js",
    "test-single-run": "karma start test/karma.conf.js  --single-run",

    "preupdate-webdriver": "npm install",
    "update-webdriver": "webdriver-manager update",

    "preprotractor": "npm run update-webdriver",
    "protractor": "protractor test/protractor-conf.js",

    "update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/, '//@@NG_LOADER_START@@\\n' + cat('bower_components/angular-loader/angular-loader.min.js') + '\\n//@@NG_LOADER_END@@', 'app/index-async.html');\""
  }
}

Anthony-Mckale avatar Jul 02 '14 08:07 Anthony-Mckale

@Anthony-Mckale - you are quite right. There was a bug in Protractor that is solved with v1.x. I will update the phonecat project accordingly. Thanks for your help.

petebacondarwin avatar Jul 02 '14 10:07 petebacondarwin

one wee other thing, if you upgrade the karma version, the jasmine version will jump from 1.3 to 2.0, the karma/jasmine for matchers is all different and will need to be changed https://docs.angularjs.org/tutorial/step_11 :

  beforeEach(function(){
    this.addMatchers({
      toEqualData: function(expected) {
        return angular.equals(this.actual, expected);
      }
    });
  });

now -->

beforeEach(function( ){
        jasmine.addMatchers({
            toEqualData: function(util, customEqualityTesters) {
                return {
                    compare: function (actual, expected) {
                        var result = {};
                        result.pass = angular.equals(actual, expected);
                        result.message = "meow something is wrong";
                        return result;
                    }
                }
            }
        });
    });

would do a merge push request with changes but i'm afraid of the git step stuff, never used that feature before, but it is amazingly cool

Anthony-Mckale avatar Jul 02 '14 10:07 Anthony-Mckale

@Anthony-Mckale - that is not actually the case. We are using karma-jasmine v 0.1.5, which is using Jasmine v 1.3. Perhaps you have somehow installed karma-jasmine@2_0?

petebacondarwin avatar Jul 02 '14 11:07 petebacondarwin

ah ok perhaps :)

Anthony-Mckale avatar Jul 02 '14 11:07 Anthony-Mckale

Changing chromeOnly: true to false; worked for me! Thanks @eduardobape

Benjamin-Dada avatar Jul 06 '15 10:07 Benjamin-Dada

It's 2019 and I'm having the same problem.

`> [email protected] protractor C:\Users\xxxxx\yyyyyy\Ang1Refresher\phonecat\angular-phonecat

protractor e2e-tests/protractor.conf.js

[08:54:20] I/launcher - Running 1 instances of WebDriver [08:54:20] I/local - Starting selenium standalone server...
[08:54:20] E/launcher - Error: Error: Server terminated early with status 1 at earlyTermination.catch.e (C:\Users\xxxxx\yyyyy\Ang1Refresher\phonecat\angular-phonecat\node_modules\selenium-webdriver\remote\index.js:252:52) at process._tickCallback (internal/process/next_tick.js:68:7)[08:54:20] E/launcher - Process exited with error code 100
npm ERR! code ELIFECYCLE npm ERR! errno 100 npm ERR! [email protected] protractor: protractor e2e-tests/protractor.conf.js npm ERR! Exit status 100 npm ERR! npm ERR! Failed at the [email protected] protractor script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\xxxxxx\AppData\Roaming\npm-cache_logs\2019-09-16T06_54_20_981Z-debug.log`

Have tried setting 'chromeOnly: fasle' and manually updating webdriver-managar(een though npm run protractor does npm install and webdriver-manager update on start.

On Win10 latest.

ctp-placebo avatar Sep 16 '19 07:09 ctp-placebo