본문 바로가기
💎 리액트

[React] ERROR in Module.createRequire is not a function 해결

by 비타민찌 2022. 6. 10.
728x90

리액트 실행 중..

ERROR in Module.createRequire is not a function 에러가 났다.

 

삽질 끝에 npm과 node의 버전 때문인 것을 알았다.

 

node는 14.0.0 이상,

npm은 5.6 이상이어야 아래 에러가 안난다.

 

ERROR in Module.createRequire is not a function

ERROR in   Error: Child compilation failed:
  Module.createRequire is not a function

  - child-compiler.js:169 childCompiler.runAsChild

  - Compiler.js:559 compile

  - Compiler.js:1129 hooks.afterCompile.callAsync.err

  - Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync]
 
  - Compiler.js:1125 compilation.seal.err

  - Compilation.js:2782 finalCallback
 
  - Compilation.js:3087 hooks.afterSeal.callAsync.err

  - Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync]
  
1 ERROR in child compilations (Use 'stats.children: true' resp. '—stats-children' for more details)

 

+ n업그레이드는 다음 명령어로 할 수 있다.

npm install -g npm
npm install npm@latest -g

 

node 14 버전 이상 설치는 다음 블로그에 나와있다.

https://blog.naver.com/ghdalswl77/222761052659

 

728x90

댓글