본문 바로가기

nodeJS

webpack 설치 후 Error: Cannot find module 'webpack'

웹팩 설치 이후 npm start시 Error: Cannot find module 'webpack' 발생

C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web>npm start

> eatgo-web@1.0.0 start C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web
> webpack-dev-server --port 3000

internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module 'webpack'
Require stack:
- C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web\node_modules\webpack-dev-server\bin\webpack-dev-server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web\node_modules\webpack-dev-server\bin\webpack-dev-server.js:12:17)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\ljw-study\\spring-api\\workspace\\SpringApi\\eatgo-web\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! eatgo-web@1.0.0 start: `webpack-dev-server --port 3000`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the eatgo-web@1.0.0 start 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\LJW\AppData\Roaming\npm-cache\_logs\2020-07-26T12_08_02_983Z-debug.log

C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web>npm start

> eatgo-web@1.0.0 start C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web
> webpack-dev-server --port 3000

internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module 'webpack'
Require stack:
- C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web\node_modules\webpack-dev-server\bin\webpack-dev-server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web\node_modules\webpack-dev-server\bin\webpack-dev-server.js:12:17)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\ljw-study\\spring-api\\workspace\\SpringApi\\eatgo-web\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! eatgo-web@1.0.0 start: `webpack-dev-server --port 3000`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the eatgo-web@1.0.0 start 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\LJW\AppData\Roaming\npm-cache\_logs\2020-07-26T12_08_41_398Z-debug.log

C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web>cls

C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web>npm start

> eatgo-web@1.0.0 start C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web
> webpack-dev-server --port 3000

internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module 'webpack'
Require stack:
- C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web\node_modules\webpack-dev-server\bin\webpack-dev-server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web\node_modules\webpack-dev-server\bin\webpack-dev-server.js:12:17)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\ljw-study\\spring-api\\workspace\\SpringApi\\eatgo-web\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! eatgo-web@1.0.0 start: `webpack-dev-server --port 3000`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the eatgo-web@1.0.0 start 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\LJW\AppData\Roaming\npm-cache\_logs\2020-07-26T12_10_06_138Z-debug.log

 

 

npm link webpack 실행후 정상 수행

C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web>npm link webpack
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
C:\Users\LJW\AppData\Roaming\npm\webpack -> C:\Users\LJW\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js
npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"12.18.3","npm":"6.14.6"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\webpack\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\webpack\node_modules\watchpack-chokidar2\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ webpack@4.44.0
added 343 packages from 200 contributors in 27.903s
C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web\node_modules\webpack -> C:\Users\LJW\AppData\Roaming\npm\node_modules\webpack

C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web>npm start

> eatgo-web@1.0.0 start C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web
> webpack-dev-server --port 3000

i 「wds」: Project is running at http://localhost:3000/
i 「wds」: webpack output is served from /
i 「wds」: Content not from webpack is served from C:\ljw-study\spring-api\workspace\SpringApi\eatgo-web
i 「wdm」: Hash: 0276483e85f93218c481
Version: webpack 4.44.0
Time: 463ms
Built at: 2020-07-26 9:10:53 ├F10: PM┤
  Asset     Size  Chunks             Chunk Names
main.js  365 KiB    main  [emitted]  main
Entrypoint main = main.js
[0] multi ./node_modules/webpack-dev-server/client?http://localhost:3000 ./src 40 bytes {main} [built]
[../../../../../Users/LJW/AppData/Roaming/npm/node_modules/webpack/hot/emitter.js] (webpack)/hot/emitter.js 75 bytes {main} [built]
[../../../../../Users/LJW/AppData/Roaming/npm/node_modules/webpack/hot/log.js] (webpack)/hot/log.js 1.34 KiB {main} [optional] [built]
[../../../../../Users/LJW/AppData/Roaming/npm/node_modules/webpack/node_modules/url/url.js] (webpack)/node_modules/url/url.js 22.8 KiB {main} [built]
[./node_modules/ansi-html/index.js] 4.16 KiB {main} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost:3000] ./node_modules/webpack-dev-server/client?http://localhost:3000 4.29 KiB {main} [built]
[./node_modules/webpack-dev-server/client/overlay.js] 3.51 KiB {main} [built]
[./node_modules/webpack-dev-server/client/socket.js] 1.53 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] 2.91 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/log.js] 964 bytes {main} [built]
[./node_modules/webpack-dev-server/client/utils/reloadApp.js] 1.59 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/sendMessage.js] 402 bytes {main} [built]
[./node_modules/webpack-dev-server/node_modules/strip-ansi/index.js] 161 bytes {main} [built]
[./node_modules/webpack/hot sync ^\.\/log$] ./node_modules/webpack/hot sync nonrecursive ^\.\/log$ 170 bytes {main} [built]
[./src/index.js] 0 bytes {main} [built]
    + 18 hidden modules
i 「wdm」: Compiled successfully.

 

'nodeJS' 카테고리의 다른 글

Webpack 설치  (0) 2020.07.26
nodeJS 초기 세팅  (0) 2020.07.26