Yeoman' grunt test'使用'端口已经在使用的干净项目失败'

时间:2013-07-01 02:33:23

标签: angularjs gruntjs yeoman

使用:

  • Mac OS 10.8.4
  • 节点0.10.12
  • npm 1.3.1
  • grunt-cli 0.1.9
  • yo 1.0.0-rc.1
  • bower 0.9.2
  • generator-angular@0.3.0

我在干净的yo angular项目中遇到以下错误,然后是grunt server,然后是grunt test

Running "connect:test" (connect) task  
Fatal error: Port 9000 is already in use by another process.

我是Yeoman的新手,我很难过。我删除了我的原始项目,并在一个新文件夹中创建了一个新项目,以确保我没有忽略任何隐形配置。我重新启动机器以确保我没有运行任何我忘记的临时服务器进程。在所有尝试之后,基本服务器启动正常,附加到Chrome,并且观察者在任何更改时更新浏览器。 (值得注意的是,服务器运行在9000上,对于测试运行者而言,尝试使用9000似乎很奇怪。)但是在尝试启动测试运行器时我遇到了同样的错误。

这是我可以解决的问题,还是我应该向Yeoman团队报告的问题?感谢。

3 个答案:

答案 0 :(得分:5)

添加port: 9001进行测试,如下所示:

test: {
  options: {
    port: 9001,
    ...
  }
}

答案 1 :(得分:2)

我创建了一个新的配置属性:connect.test.options.port,并将其设置为9001.现在它们似乎在不同的端口上正常运行。

另请注意,Gruntfile.js会覆盖singleRun中的karma.conf.js属性。如果您希望karma.conf.js中的配置正常工作,请注释/删除它。

编辑11/4/13: 其他人也报告了The issue,似乎已经通过对generator-angular的更改进行了解决。

答案 2 :(得分:1)

更改端口后,出现XHR错误, The 'Access-Control-Allow-Origin' header has a value 'http://localhost:9000' that is not equal to the supplied origin. Origin 'http://localhost:9090' is therefore not allowed access. 最初是9000然后我改变了咕噜声

connect: {
  main: {
    options: {
      port: 9090
    }
  }
}
相关问题