启动服务器和测试"server closed unexpectedly"



我正在使用启动服务器和测试包在我的Azure管道上启动一个服务器来运行Cypress。

这是我用来启动一切的yarn命令:yarn cy:build:workspace

"cy:build:workspace":"yarn cy:clean&&启动服务器并测试启动http://localhost:8080cy:run:workspace">

我正在Azure环境上运行NODE_VERSION:"12.10.0"。

"C:windowssystem32cmd.exe" /D /E:ON /V:OFF /S /C "CALL "d:a_tempce28689e-eef6-4eeb-bad2-82310f748e1b.cmd""
yarn run v1.22.4
$ yarn cy:clean && start-server-and-test start http://localhost:3000 cy:run:workspace
$ rimraf cypress/reports/*
1: starting server using command "npm run start"
and when url "[ 'http://localhost:3000' ]" is responding with HTTP status code 200
running tests using command "npm run cy:run:workspace"

> @someProjectsbs/suite-packages@0.1.1 start D:a1s
> lerna exec --scope=@someProjectsbs/suite -- yarn start --all-apps
lerna notice cli v3.20.2
lerna info ci enabled
lerna notice filter including "@someProjectsbs/suite"
lerna info filter [ '@someProjectsbs/suite' ]
lerna info Executing command in 1 package: "yarn start --all-apps"
$ cross-env react-app-rewired start --extended-linting --all-apps
[]
[info] [webpackbar] Compiling @someProjectsbs/suite
(node:4672) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
i 「wds」: Project is running at http://192.168.0.100/
i 「wds」: webpack output is served from 
i 「wds」: Content not from webpack is served from D:a1spackagesappsuitepublic
i 「wds」: 404s will fallback to /
Starting the development server...
lerna success exec Executed command in 1 package: "yarn start --all-apps"
Error: server closed unexpectedly
at ChildProcess.onClose (D:a1snode_modulesstart-server-and-testsrcindex.js:69:14)
at ChildProcess.emit (events.js:209:13)
at ChildProcess.cp.emit (D:a1snode_modulesstart-server-and-testnode_modulescross-spawnlibenoent.js:34:29)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
##[error]Cmd.exe exited with code '1'.
Finishing: Run Cypress testsk

在本地,我已经运行了所有的东西,有什么建议吗?为什么服务器停止在Azure环境上?

如果您使用的是"react scripts",请检查您的package.json:"3.4.1"降级到3.4.0

还要验证此链接以使用启动服务器并使用yarn进行测试,您需要像字符串一样添加一些yarn命令https://github.com/bahmutov/start-server-and-test#note-用于纱线用户

我遇到了同样的问题,但转到wait-on解决了的问题

https://docs.cypress.io/guides/guides/continuous-integration.html#Boot-您的服务器

CI环境变量设置为true。来源:https://github.com/facebook/create-react-app/issues/8688#issuecomment-642309787

相关内容

最新更新