티스토리 뷰

트러블슈팅
시스템 안의 문제를 분석하여 해결하는 것

react 학습을 위해 개발환경 설정을 하고 있었다.

yarn을 통해 install 하고있다.

참고로 필자는 react를 처음 사용해보기 때문에

그냥 싹 다 지우고 다시 깔아도 문제가 발생하지 않는 상황이었다.

 


본래 create react를 설치하고

yarn install을 하면

Compiled successfully!

webpack compiled successfully

 

이런 문구가 나오는게 정상인데, 

나 같은 경우는 다음과 같은 오류 메세지가 떴다.

Usage Error: The nearest package directory (/Users/ak47/toy/react/test) doesn't seem to
be part of the project declared in /Users/ak47.

검색을 해도 나 같은 경우는 잘 안나오고

결국 오빠한테 부탁해서 해결하는 와중

 

내 디렉토리 리스트를 터미널로 일일이 살펴보던 중 문제를 발견했다.

 

바로 이상한 곳에 package.json이 있다는 것.

➜  react ls ..
react            scss-MASTERCLASS scss-study       scss-text
➜  react ls ../..
Applications Documents    Library      Music        Public       toy
Desktop      Downloads    Movies       Pictures     package.json

저 디렉토리는 이름만 봐도 알 수 있겠지만 개발 디렉토리가 아니고

그냥 전체 디렉토리 범주다.

 

해당 디렉토리 안에 있는 package.json을 삭제하고,

test 디렉토리를 지웠다 다시 만들고 처음부터 install했다.

 

참고

모든 개발(vanillaJS, react 등)은 toy 디렉토리 안에서 진행

toy 디렉토리 내부의 react 디렉토리 안에서

처음으로 test 디렉토리를 만들어

동작하는지 확인 중이었음

➜  react cat ~/.pa
cat: /Users/ak47/.pa: No such file or directory
➜  react cat ~/package.json
{
  "packageManager": "yarn@3.4.1"
}
➜  react ls
➜  react ls
➜  react ls -al
total 0
drwxr-xr-x  2 ak47  staff   64  3 13 22:58 .
drwxr-xr-x@ 7 ak47  staff  224  3  8 20:51 ..
➜  react ls ..
react            scss-MASTERCLASS scss-study       scss-text
➜  react yarn create react-app test

해결되었다.

We suggest that you begin by typing:

  cd test
  yarn start

Happy hacking!
➜  react ls
basic
➜  react
댓글