본문 바로가기
개발자의 정보/JS & framework

에러 해결법: directories in the root is deprecated, please specify in the build

by pastory 2020. 4. 14.

왜 이런 오류를 만나게 되는가

electron-builder를 이용한 프로젝트 제작시 가끔 만나게 되는 문제들이 좀 있다. 그것은 버전과도 관련된 문제인데 나처럼 생각없이 업데이트 하는 것을 좋아하는 사람들은 그런 경우가 더욱 많을 것으로 생각된다.

"directories" in the root is deprecated, please specify in the "build"

이 문구의 내용은 directories는 더이상 package.json의 최상위에서 사용할 수 없으니 build 안에 정의하라는 내용이다.

이런 문구를 만났다면 아마 당신도 나와 같이 아무런 생각없이 업데이트를 하는 사람일 확률이 높다. 혹은 다른사람이 만든 프로젝트를 활용하려고 했는데 버전이 달랐을 수도 있겠다.

이번에 내가 만난 오류 내용도 다음과 같다.

> electron-builder --x64

  • electron-builder  version=22.4.1 os=19.4.0
  • loaded configuration  file=/my_project_dir/electron-builder.yml
  ⨯ "directories" in the root is deprecated, please specify in the "build"
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project_name@project_version dist: `electron-builder --x64`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the project_name@project_version dist script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

어떻게 해결할 수 있나

electron-builder 버전을 처음 설계된 버전으로 바꾸어 해결할 수도 있지만 그렇게 하지 않아도 해결은 가능하다. package.json 내용을 바꾸어 주면 된다.

  "directories": {
    "doc": "docs"
  }

이렇게 되어 있던 부분을 지워 주어야 한다. 빌더에서 지원되는 내용에 대한 자세한 옵션은 https://www.electron.build/configuration/configuration 페이지에서 찾아볼 수 있다.

추가로 일렉트론빌더 깃허브 페이지도 둘러보면 더 좋다.

댓글