🤦♀️ Ubuntu React 설치 오류
Ubuntu에 React 프로젝트를 생성하던 중 오류를 발견하였습니다.
오류의 내용은 다음과 같습니다.
npx: installed 67 in 19.296s
(node:719650) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, mkdir '/home/git/reactex/myapp'
at Object.mkdirSync (fs.js:1009:3)
at Object.module.exports.makeDirSync (/home/ubuntu/.npm/_npx/719650/lib/node_modules/create-react-app/node_modules/fs-extra/lib/mkdirs/make-dir.js:101:15)
at createApp (/home/ubuntu/.npm/_npx/719650/lib/node_modules/create-react-app/createReactApp.js:255:6)
at /home/ubuntu/.npm/_npx/719650/lib/node_modules/create-react-app/createReactApp.js:226:9
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:719650) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:719650) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
뜯어 보면 눈에 띄는 오류들이 있습니다.
(node:719650) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, mkdir ‘/home/git/reactex/myapp’
(node:719650) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:719650) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
이를 해결하기 위해 여러 삽질을 했지만, 가장 간단하게 앞 쪽에서 해결해야할 문제를 찾을 수 있었습니다.
✨ 문제 해결
Ubuntu에서 sudo su
로 root사용자로 로그인 한 뒤 cd
커맨드로 원하는 폴더에 진입합니다.
그 뒤 npx create-react-app myapp
을 입력하면 오류 없이 React 프로젝트를 Ubuntu에 생성할 수 있습니다.