yarnpkgyarnpkg-v3

Yarn run someScript outputs "command not found: export"


I've upgraded to the yarn version 3.1.0 (previously was 1.x and everything worked fine).

In the package.json of the project there is a script with the next structure:

"scripts": {
  "someScript": "export NODE_ENV=development && ...",
}

When running

yarn run someScript

or

yarn someScript

shell outputs

command not found: export

When running in the shell export command itself it's found and lists found environmental variables.

What's the problem of running scripts with yarn consisting "export" command (for setting environmental variables)? What should be written and where for it to work as in version 1.x or is there a new way to set environment?


Solution

  • export is a shell builtin.

    Try without export, something like:

    "scripts": {
      "someScript": "NODE_ENV=development env",
    }