You can use cross-env, a package that sets environment variables across platforms. First, install cross-env as a dev dependency:
npm install cross-env --save-dev
Then, modify your build script to use cross-env to set the BUILD_PATH:
"scripts": {
"dev": "react-scripts start",
"build": "cross-env BUILD_PATH=../server/public react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Now, when you run the build script, it should properly set the BUILD_PATH environment variable across different platforms.
