''BUILD_PATH' is not recognized as an internal or external command

I want to run a backend server along with frontend on same server. So I build the frontend and provided a build path but this is not working.

Here is my npm script file.

{
  "name": "nasa-fe",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "arwes": "^1.0.0-alpha.5",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "^4.0.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "BUILD_PATH=../server/public react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

When I run build command it's showing 'BUILD_PATH' is not recognized as an internal or external command. How do I fix this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source