Hello,

kok nae-ga ha-myun an-dweneun MAGIC...🧚

웹 프로그래밍/에러로그

Yarn install error :: The --cwd option is ambiguous when used anywhere else than the very first parameter provided in the command line, before even the command path

✿도담도담 2024. 2. 28. 18:34

Next.js 버전 14를 다시 공부하려고 설치를 하려던 도중

강의는 npm을 이용했지만 이제 yarn berry를 이용해보고 싶은 마음에 개인적으로 yarn berry로 셋팅을 했는데...또 나망 앙댕..😩

package.json은 아래와 같았다.

{
  "name": "next14-example",
  "packageManager": "yarn@4.1.0",
  "scripts": {
    "dev": "next dev"
  },
  "dependencies": {
    "next": "^14.1.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  }
}

 

여기서 yarn dev를 실행 했는데 아래와 같은 에러가 발생했다!

 

음...🤔 읽어보면 보자...

3000번 포트가 사용중이라 3001번이 사용 됐구...

아 그다음은 app 폴더에 page.tsx로 Typescript를 사용하고 싶어 했더니 자기가 설치해주겠다고 한다.

그리고 Typescript를 이용하고 싶지 않다면 tsconfig.json을 지우라고 한다.

typescript, @types/react, @types/node 요 세 친구를 설치해주려고

'yarn add --exact --cwd /Users/dodam/Documents/my-apps/dev/next14-example --dev typescript @types/react @types/node' 해당 명령어를 실행하던 도중에 만난 에러인 것 같다.

 

 

사실 --exact --cwd 명령어를 빼고 설치 명령어 입력시 정상적으로 됐다.

그래도 찾아보구 가야지 🫨

  • --exact: 패키지의 정확한 버전 명시
  • --cwd(Current Working Directory): 작업 디렉토리 설정 

오류 그대로 한번 읽어보면 --cwd 옵션을 사용할때 해당 명령어가 첫 번째 매개변수로 사용되어야 한다기에...

아래와 같이 수정해서 명령어를 입력해서 설치했다..!

yarn --cwd /Users/dodam/Documents/my-apps/dev/next14-example add --exact --dev typescript @types/react @types/node

 

Next에서 잘 못 명령어를 실행하는 버그일까? 한다...!