Error: spawn UNKNOWN

2019-08-01 07:28发布

问题:

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
  }
};

回答1:

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