0

I'm using window git bash, here's what I did:

  1. git clone a project
  2. run npm run dev

I got '..' is not recognized as an internal or external command,

the package.json look like this

{
  "name": "something",
  "scripts": {
    "cypress:open": "../../node_modules/.bin/cypress open",
    "dev": "../../node_modules/.bin/start-test 7079 cypress:open",
  }
}

is this windows related issue?

I was trying to run https://github.com/cypress-io/cypress-example-recipes in windows.

torek
  • 448,244
  • 59
  • 642
  • 775
Alice88
  • 1
  • 1
  • 2
    If you’re running on windows why is the question tagged Linux? – evolutionxbox Feb 12 '21 at 13:07
  • @evolutionxbox because I was using mac I never got this issue, I'm new to window, I'm guessing it's window related issue – Alice88 Feb 12 '21 at 13:08
  • I am inclined to think that it is a git bash issue, not a general bash issue, and inasmuch as git bash is a build of bash specifically for Windows, yes, that makes it a Windows-related issue. – John Bollinger Feb 12 '21 at 13:09
  • For example, the `/` character is typically used to introduce command-line options in Windows' traditional command interpreters, whereas it is the file separator character on Unix. Possibly git bash implements Windows-like instead of Unix-like command-line interpretation. If so, then it is probably unsuited for use with general bash scripts, which will make different assumptions. – John Bollinger Feb 12 '21 at 13:13
  • Wrap the pathnames in your npm scripts with JSON escaped double quotes, i.e. \"...\". For example: `"dev": "\"../../node_modules/.bin/start-test\" 7079 cypress:open",` and `"cypress:open": "\"../../node_modules/.bin/cypress\" open",` – RobC Feb 12 '21 at 13:17
  • @RobC nope, no luck with that. – Alice88 Feb 12 '21 at 14:03
  • @RobC are you using window too? can you try to run this repo without error? https://github.com/cypress-io/cypress-example-recipes thanks – Alice88 Feb 12 '21 at 16:23
  • I doubt I need to make weird escape in the package.json file, I think that's not the issue. – Alice88 Feb 12 '21 at 16:24
  • *bash* never says "not recognized as an internal or external command"; that error message comes from `cmd.exe`. See [related question](https://stackoverflow.com/q/41454769/1256452). Why cmd.exe is getting involved, I have no idea. This has nothing to do with Linux or Git, though (`git-bash` has nothing to do with Git either, despite the name), so I'm going to snip off a few tags. – torek Feb 13 '21 at 12:19

0 Answers0