'"build": "react-scripts build && cp -R ./build/* ../main/resources/public /s /y" did not for my Mac

"build": "react-scripts build && cp -R ./build/* ../main/resources/public /s /y" did not for my Mac. it is not executed by yarn build command.in my terminal i am getting this! please give a solution. thanks in advance.



Solution 1:[1]

it works for me, perfectly: "build": "react-scripts build/* && cp -R /Users/arif/Desktop/javaProjects/ipl-springboot/src/frontend/ipl-frontend/build/* /Users/arif/Desktop/javaProjects/ipl-springboot/src/main/resources/public/",

Solution 2:[2]

it solved with the followings:

"build": "react-scripts build && cp -R /Users/arif/IdeaProjects/ipl-springboot2/src/frontend/ipl-frontend/build/* /Users/arif/Desktop/javaProjects/ipl-springboot/src/main/resources/public/", ....

let me break this out:

1st part: react-scripts build;

this is the default react build path in the public folder within the react app in the package.json file.

2nd part: cp -R;

this is the copy command for mac ios (for windows it is xcopy)

3rd part: cp -R /Users/arif/IdeaProjects/ipl-springboot2/src/frontend/ipl-frontend/build/*;

this will copy the whole build folder (all of the files within the build folder);

/Users/arif/IdeaProjects/ipl-springboot2/src/frontend/ipl-frontend/build: this is the path of the source folder which need to be copied.

4th part: "/Users/arif/Desktop/javaProjects/ipl-springboot/src/main/resources/public/" ;

this is the destination folder that needs to be copied.

So in short:

"build": "react-scripts build && cp -R [path of source folder]/* [path of destination folder]",

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Arif Ahmed
Solution 2