Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix initial installation on windows #18241

Merged
merged 5 commits into from
Sep 25, 2021

Conversation

userquin
Copy link
Contributor

@userquin userquin commented Sep 24, 2021

Context

After following the CONTRIBUTING.md guide, there are still errors running certain packages while developing in the Cypress repo on a Windows machine.

How to test

  1. Follow the CONTRIBUTING.md guide
  2. Run yarn and install deps from the root directory of the project.

Current Behavior

When running yarn from the root once installed node and python there are errors.

There are scripts running yarn <node_modules/.bin/command> ...args commands, and they will fail on windows since they resolve to <node_modules/.bin/command> instead <node_modules/.bin/command.cmd>.

For example, on npm/vue we got this error:

@packages/electron: Packaging app for platform win32 x64 using electron v13.2.0
cypress: exec babel index.js -o build/index.js
@cypress/vue: /usr/bin/bash: F:workprojectsquiniGitHubcypress-developmentnode_modules.binrollup: command not found
@cypress/vue: error Command failed with exit code 127.
@cypress/vue: error Command failed with exit code 127.
lerna ERR! yarn run build exited 127 in '@cypress/vue'
lerna WARN complete Waiting for 5 child processes to exit. CTRL-C to exit immediately.

New Behavior

  • It doesn't crash on windows.
  • You can run the Cypress build tasks.

Tests

N/A

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 24, 2021

Thanks for taking the time to open a PR!

@CLAassistant
Copy link

CLAassistant commented Sep 24, 2021

CLA assistant check
All committers have signed the CLA.

@JessicaSachs JessicaSachs self-requested a review September 25, 2021 00:04
@userquin
Copy link
Contributor Author

As a reminder, do not use yarn to execute binaries since it will break executions on windows, use the binary directly.

For example, reviewing the unified-desktop-gui branch about using unplugin-icons, you were using yarn vite dev and yarn vite build instead creating/updating a new script using directly vite:

"scripts": {
  "vite:dev": "vite",
  "vite:build": "vite build",
  "vite:preview": "yarn vite:build && vite preview"
}

You're using vite when building for production: "build-prod": "cross-env NODE_ENV=production vite build" .

Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the need for npm/create-cypress-tests/scripts/copy-templates.js. Can we use an existing library?

@@ -5,9 +5,10 @@
"private": false,
"main": "index.js",
"scripts": {
"build": "yarn prepare-example && tsc -p ./tsconfig.json && node scripts/example copy-to ./dist/initial-template && yarn copy \"./src/**/*.template.js\" \"./dist/src\"",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, there has to be an easier way, right? Why is copy-templates necessary? Will something like this work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just try build the scope

Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We spoke about this again, and we currently actually have no pattern within the build scripts for copying globbed files. (super weird). The other place we copy files within the scripts directory doesn't handle globs and isn't that pretty.

This fixes some windows development environments, so I think it's good to merge.

@JessicaSachs JessicaSachs merged commit 853a6f5 into cypress-io:develop Sep 25, 2021
@JessicaSachs JessicaSachs changed the title fix: initial installation on windows chore: fix initial installation on windows Sep 25, 2021
@userquin userquin deleted the fix/install-on-windows branch September 25, 2021 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants