강의

멘토링

커뮤니티

Inflearn Community Q&A

wkdzhd20003291's profile image
wkdzhd20003291

asked

Learn Docker and CI environment by following [2023.11 update]

Install React App

sh: react-scripts: command not found

Written on

·

2.5K

1

분명히 package.json에 react-scripts가 알맞게 들어가있는 것을 확인하였고 src나 public, node-modules같은 폴더가 빠진 것도 없었습니다.

 

하지만 npm run start 혹은 npm start를 할 때 마다

sh: react-scripts: command not found 라는 오류가 발생했습니다. npm test나 npm build 역시 마찬가지였습니다.

구글링하며 이래저래 답을 찾던 중

https://exerror.com/sh-react-scripts-command-not-found/

해당 링크의 글을 읽고 package.json의 scripts 명령어들을 아래와 같이 바꾸니 겨우 실행이 되었습니다.

"start": "NODE_ENV=production node_modules/react-scripts/bin/react-scripts.js start",
"build": "NODE_ENV=production node_modules/react-scripts/bin/react-scripts.js build",
"test": "NODE_ENV=test node_modules/react-scripts/bin/react-scripts.js test",

지금도 왜 그런지 원인은 알 수 없습니다..

npm 지웠다가 npm install도 다시해보고 저 글들에서

제시하는 다른 방법들은 다 해보았을 때 먹히지 않았습니다.

오로지 위 명령어들만 작동하였습니다.

 

강사님의 답변 속도가 아무래도 빠를 수 없기도 하고

문제는 본디 스스로 해결할 줄도 알아야해서 왠만하면 질문은 남기지 않는 편입니다.

다른 분들도 해결안되신다면 우선 위 명령어로 바꾸어 시도해보시기 바랍니다.

왜 위 명령어만 작동하는지 혹시 이유를 아시는 분은 답변 남겨주신다면 더없이 감사하겠습니다 :)

 

cicd데이터 엔지니어링travis-cigithubdockeraws

Answer 1

2

npm i -g react-scripts하시고 npm install하고 npm start로 실행하시면 될거에요

구세주 ㅠㅠㅠㅠ 감사합니다

wkdzhd20003291's profile image
wkdzhd20003291

asked

Ask a question