프로그래밍/JavaScript

[React] yarn build fail - query-string 모듈이 문제일 때 해결 방법

seungdols 2018. 9. 28. 01:50

query-string module Build 오류

❯ yarn build
yarn run v1.9.4
warning ../package.json: No license field
warning ../../package.json: No license field
$ NODE_PATH=src node scripts/build.js
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

./node_modules/query-string/index.js:8

Read more here: http://bit.ly/2tRViJ9

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

이미 패키지를 eject로 루트 경로로 환경설정을 추출 했는데, 이렇게 오류가 발생한 경우 읽을 수 있는 링크가 존재한다.

create-react-app react-scripts관련 링크를 타고 들어가서 보면 확인 할 수 있다.

일단, 첫째로 내가 해결한 방법은 react-scripts버전을 올렸다.

yarn add --exact react-scripts@2.0.0~

위의 명령어로 migrate를 할 수 있다.

그리고 build를 해보았으나, 실패했다.

그래서 두번째로 query-string모듈의 버전을 다운시켰다.

"query-string": "~5.1.1",

기존에는 ^6.1.1이었다. 그걸 react-admin 이슈를 보고 버전을 바꿔보기로 했다.

위 처럼 버전을 바꾸기 위해서 package.json에서 query-string 모듈 버전을 위처럼 바꾸고, 저장 했다.

$ yarn

위처럼 package.json 파일을 갱신 했기때문에, 다시 명령어를 입력해주었다. 그리고 다시 빌드를 해보니 정상적으로 동작 한다.



반응형