인프런 커뮤니티 질문&답변

심성현님의 프로필 이미지
심성현

작성한 질문수

Slack 클론 코딩[실시간 채팅 with React]

babel과 webpack 설정하기

npm run build시 에러발생

작성

·

391

0

$ npm run build

> alecture@1.0.0 build D:\study\sleact\alecture

> cross-env TS_NODE_PROJECT="tsconfig-for-webpack-config.json" webpack

[webpack-cli] Failed to load 'D:\study\sleact\alecture\webpack.config.ts' config

[webpack-cli] Error: Cannot find module 'react-refresh/babel'

Require stack:

- D:\study\sleact\alecture\webpack.config.ts

- D:\study\sleact\alecture\node_modules\webpack-cli\lib\webpack-cli.js

- D:\study\sleact\alecture\node_modules\webpack-cli\lib\bootstrap.js

- D:\study\sleact\alecture\node_modules\webpack-cli\bin\cli.js

- D:\study\sleact\alecture\node_modules\webpack\bin\webpack.js

    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)

    at Function.resolve (D:\study\sleact\alecture\node_modules\v8-compile-cache\v8-compile-cache.js:164:23)

    at Object.<anonymous> (D:\study\sleact\alecture\webpack.config.ts:46:68)

    at Module._compile (D:\study\sleact\alecture\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)

    at Module.m._compile (D:\study\sleact\alecture\node_modules\ts-node\src\index.ts:1225:23)

    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)

    at Object.require.extensions.<computed> [as .ts] (D:\study\sleact\alecture\node_modules\ts-node\src\index.ts:1228:12)

    at Module.load (internal/modules/cjs/loader.js:950:32)

    at Function.Module._load (internal/modules/cjs/loader.js:790:14)

    at Module.require (internal/modules/cjs/loader.js:974:19) {

  code: 'MODULE_NOT_FOUND',

  requireStack: [

    'D:\\study\\sleact\\alecture\\webpack.config.ts',

    'D:\\study\\sleact\\alecture\\node_modules\\webpack-cli\\lib\\webpack-cli.js',

    'D:\\study\\sleact\\alecture\\node_modules\\webpack-cli\\lib\\bootstrap.js',

    'D:\\study\\sleact\\alecture\\node_modules\\webpack-cli\\bin\\cli.js',

    'D:\\study\\sleact\\alecture\\node_modules\\webpack\\bin\\webpack.js'

  ]

}

npm ERR! code ELIFECYCLE

npm ERR! errno 2

npm ERR! alecture@1.0.0 build: `cross-env TS_NODE_PROJECT="tsconfig-for-webpack-config.json" webpack`

npm ERR! Exit status 2

npm ERR!

npm ERR! Failed at the alecture@1.0.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\shsim\AppData\Roaming\npm-cache\_logs\2021-07-15T15_30_20_092Z-debug.log

---------------------------------------------------

기존 alecture 폴더로 명령어 진행시 정상적으로 실행됩니다. 여러번 삭제후 해도 똑같은 에러만 표시됩네요

답변 1

1

제로초(조현영)님의 프로필 이미지
제로초(조현영)
지식공유자

npm i -D react-refresh 하세요

심성현님의 프로필 이미지
심성현

작성한 질문수

질문하기