[오류] sourcemap 오류 해결

안치영·2022년 11월 24일
0

오류모음

목록 보기
2/2

프로젝트 협업 도중 dev 브랜치의 파일들을 pull 받아온 후
npm i 를 했는데, 자꾸 sourcemap warning이 떠서 신경이 쓰여서 찾아 봤는데,

package.json 파일에 Debug 부분에

"scripts": {
    "start": "GENERATE_SOURCEMAP=false react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

위와 같이 GENERATE_SOURCEMAP=false 를 start부분에 넣어주면 해결이 된다고 나와있었다.

근데 추가를 했음에도 불구하고 계속 이런 오류가 났다.

'GENERATE_SOURCEMAP'() 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! projectname@1.2.0 build: `GENERATE_SOURCEMAP=false react-scripts build && gulp licenses`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the projectname@1.2.0 build 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:
npm ERR!     C:\Users\DJ\AppData\Roaming\npm-cache\_logs\2021-10-21T02_09_09_815Z-debug.log

그래서 찾아본 결과 ..!

stackoverflow 오류해결 참고 링크

OS문제라고 한다..

mac으로 했을때는 문제가 없었지만, 내가 작업하고 있던 곳은 window환경이라
따로 아래와 같이 추가를 해줘야한다.

"scripts": {
    "start": "react-scripts start",
    "winstart": "set \"GENERATE_SOURCEMAP=false\" && react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

이렇게 하니 오류가 말끔히 사라졌다.

0개의 댓글