5

I upgraded our projects yarn from v1.22 to v3.1.1. We use workspaces, so I have that plugin. Everything seems fine; other scripts work but when trying to use shell commands I get this error:

> yarn run start
command not found: if
command not found: then
command not found: fi

Here is the script from our package.json:

"scripts": {
    "build": "yarn run --top-level tsc",
    "lint": "yarn run --top-level eslint './src/**/*.{ts,js}'",
    "start": "if [[ $BLAH ]]; then yarn generateEnvFile; fi && yarn copyEnterpriseWsdl && node dist/index.js",
    "generateEnvFile": "node blah.js > .env",
    "copyEnterpriseWsdl": "cp blah blah"
  }
RobC
  • 22,977
  • 20
  • 73
  • 80
Nick
  • 4,901
  • 40
  • 61

2 Answers2

1

I ended up with more of a workaround than figuring out what the issue was:

"scripts": {
    // ...
    "start": "/bin/sh ./start-prod.sh"
  }

Where that script has what I really need to run. ‍♂️

Nick
  • 4,901
  • 40
  • 61
0

If you still want to keep the code inline, you can use the following:

"scripts": {
    // ...
    "start": "/bin/sh -c 'if [[ $BLAH ]]; then yarn generateEnvFile; fi' && yarn copyEnterpriseWsdl && node dist/index.js"
  }
Zane
  • 371
  • 2
  • 9