browserstack / browserstack-cypress-cli

NPM package for the customers to run Cypress on Browserstack Infra
MIT License
51 stars 37 forks source link

The tool assumes that the npm packages are installed using the same OS that will run the tests #282

Open bingnz opened 2 years ago

bingnz commented 2 years ago

I've run into lots of issues with running tests with results from BrowserStack that look like this:

 error: Cypress could not run any of the specs in the build since an exception occurred. The stacktrace of the error is given below:

--------------------------------------------------------------------------------
npm
WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack-chokidar2\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @cypress/webpack-preprocessor@5.11.1 requires a peer of @babel/core@^7.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN @cypress/webpack-preprocessor@5.11.1 requires a peer of @babel/preset-env@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @cypress/webpack-preprocessor@5.11.1 requires a peer of babel-loader@^8.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN node-fetch@2.6.7 requires a peer of encoding@^0.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN e2e No description
npm WARN e2e No repository field.
npm WARN e2e No license field.

npm
 ERR! code EEXIST
npm ERR! path .\packages\xxx\tests\e2e\node_modules\.bin\webpack

npm ERR!
 Refusing to delete .\packages\xxx\tests\e2e\node_modules\.bin\webpack: is outside .\packages\xxx\tests\e2e\node_modules\webpack and not a link
npm ERR! File exists: .\packages\xxx\tests\e2e\node_modules\.bin\webpack
npm
ERR! Move it away, and try again.

I suspect that this might be happening because I build the test package using a Docker container on Linux, but the machine running the tests uses Windows. Using cached packages for one OS and then trying to unzip them onto another OS is not going to work a lot of the time. I don't think the tool should be attempting to do this, or there should be some kind of opt-out.

pranavj1001 commented 2 years ago

Hey @bingnz ,

Thanks for bringing up this issue, while we look into this issue, if possible can you please share the list of npm_dependencies that you are using for your build?

Meanwhile, to circumvent this issue can you try setting cache_dependencies to false inside run_settings of your browserstack.json. Let us know if that solves your issue for now.

For more info, please visit this link.

bingnz commented 2 years ago

Hi @pranavj1001. my dependencies are:

      "@aws-sdk/client-dynamodb": "3.47.0",
      "@cypress/webpack-preprocessor": "5.11.1",
      "aws4": "1.11.0",
      "chai-datetime": "1.8.0",
      "cypress": "9.4.1",
      "cypress-fail-on-console-error": "2.1.3",
      "dayjs": "1.10.7",
      "del": "4.1.1",
      "faker": "5.5.3",
      "inversify": "5.1.1",
      "lodash": "4.17.21",
      "minimist": "1.2.5",
      "mssql": "7.3.1",
      "mysql2": "2.3.3",
      "node-vault": "0.9.22",
      "reflect-metadata": "0.1.13",
      "ts-loader": "6.2.2",
      "tslib": "2.3.1",
      "tsconfig-paths-webpack-plugin": "3.5.2",
      "typescript": "4.6.2",
      "webpack": "4.46.0"

If I use cache_dependencies false, it seems that the build just hangs (or at least takes well over an hour). I don't have any of these problems locally.

Inderjeet0007 commented 2 years ago

Hello @bingnz

Would it be possible for you to reach out to us (for the same issue) via support@browserstack.com?

bingnz commented 2 years ago

Thanks! Yes I've already done so a few days ago. I've had a few different problems, sometimes I get the npm issues as above and sometimes the build runs for two hours and then fails.