1

I am trying to follow the tutorial at https://docs.angularjs.org/tutorial and have an error running the command

npm run protractor

Here is the console log:

Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\GIT\angular-practices\angular-phonecat>npm run protractor

angular-phonecat@0.0.0 preprotractor C:\GIT\angular-practices\angular-phonecat npm run update-webdriver

angular-phonecat@0.0.0 preupdate-webdriver C:\GIT\angular-practices\angular-phonecat npm install

angular-phonecat@0.0.0 postinstall C:\GIT\angular-practices\angular-phonecat bower install

angular-phonecat@0.0.0 update-webdriver C:\GIT\angular-practices\angular-phonecat webdriver-manager update

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

angular-phonecat@0.0.0 protractor C:\GIT\angular-practices\angular-phonecat protractor test/protractor-conf.js

util.puts: Use console.log instead Using ChromeDriver directly... Error: spawn UNKNOWN at exports._errnoException (util.js:746:11) at ChildProcess.spawn (child_process.js:1162:11) at exports.spawn (child_process.js:995:9) at C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\remote\index.js:173:23 at C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\base.js:1243:15 at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\prom ise.js:1539:20) at notify (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:362:12) at [object Object].then (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:414:7) at Object.webdriver.promise.when (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:639:18) at C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\remote\index.js:172:20 ==== async task ==== WebDriver.createSession() at Function.webdriver.WebDriver.acquireSession_ (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:131:49) at Function.webdriver.WebDriver.createSession (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:111:30) at Object.createDriver (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\selenium-webdriver\chrome.js:460:30) at ChromeDriverProvider.getDriver (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\lib\driverProviders\chrome.js:67:27) at C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\lib\runner.js:221:35 at _fulfilled (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\q\q.js:797:54) at self.promiseDispatch.done (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\q\q.js:826:30) at Promise.promise.promiseDispatch (C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\q\q.js:759:13) at C:\GIT\angular-practices\angular-phonecat\node_modules\protractor\node_modules\q\q.js:525:49

Can you tell me where the problem is?

Here is my protractor conf.js:

exports.config = {
  allScriptsTimeout: 11000,

  specs: [
    'e2e/*.js'
  ],

  capabilities: {
    'browserName': 'chrome'
  },

  chromeOnly: true,

  baseUrl: 'http://localhost:8000/',

  framework: 'jasmine',

  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
  }
};
David
  • 21
  • 1
  • 6

2 Answers2

4

For those who are on a Mac and getting this error, the following open issue can cause this: https://github.com/angular/webdriver-manager/issues/476

The solution is provided by ciekawy. In

node_modules/webdriver-manager/built/lib/files/file_manager.js or

node_modules/protractor/webdriver-manager/built/lib/files/file_manager.js

add the following code at line 166:

fileUrl.url = fileUrl.url.replace(/_m1/, '');

You will then need to update the chrome drivers to pick up the change. If using NRWL's NX monorepo management tools:

npx webdriver-manager clean
npx webdriver-manager update --gecko=false --versions.chrome=<version from chrome://versions>
William Neely
  • 1,923
  • 1
  • 20
  • 23
0

in your conf.js file change to chromeOnly: false

exports.config = {
  allScriptsTimeout: 11000,

  specs: [
    'e2e/*.js'
  ],

  capabilities: {
    'browserName': 'chrome'
  },

  chromeOnly: false,

  baseUrl: 'http://localhost:8000/',

  framework: 'jasmine',

  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
  }
};

similer issue you can find here #176

Malik
  • 3,520
  • 7
  • 29
  • 42
  • hello , i went through the exact steps in https://docs.angularjs.org/tutorial . and i was able to run `npm run protractor'` command successfully . I think you must have missed one or two steps . did you run the `npm start` command from the root folder to install the npm packages ? i will update the steps in my answer . let me know whether did you do the exact thing ? – Malik Jun 12 '15 at 09:55
  • Hi, I reset the changes to step 3 doing git checkout -f step-3. Then I run: npm install; npm run update-webdriver ; npm run protractor – David Jun 12 '15 at 12:36