728x90
npm start를 실행했더니 이런 에러가 발생했습니다...
> npm start
> wordcloudtest@1.0.0 start C:\Project_Final\wordcloudTest
> set NODE_ENV=development&&webpack-dev-server
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
Require stack:
- C:\Project_Final\wordcloudTest\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Project_Final\wordcloudTest\node_modules\webpack-dev-server\bin\webpack-dev-server.js:65:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Project_Final\\wordcloudTest\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wordcloudtest@1.0.0 start: `set NODE_ENV=development&&webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wordcloudtest@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\kwg94\AppData\Roaming\npm-cache\_logs\2021-06-18T03_33_31_327Z-debug.log
원인을 알아보니 webpack과 webpack-dev-server 버전이 충돌되어 발생하는 에러라고 합니다.
이 두가지의 버전을 맞춰주면 해결된다고 하는데...
npm uninstall webpack -g
npm uninstall -g webpack-dev-server
npm install webpack@3.8.0 --save-dev
npm install webpack-dev-server@2.9.7 --save-dev
이 4가지를 실행시켜 버전을 맞춰주면 해결이 됩니다!
npm start
> wordcloudtest@1.0.0 start C:\Project_Final\wordcloudTest
> set NODE_ENV=development&&webpack-dev-server
i 「wds」: Project is running at http://localhost:8686/
i 「wds」: webpack output is served from /
i 「wds」: Content not from webpack is served from ./public
i 「wdm」: Hash: 0156ae7ee45abf035c4d
Version: webpack 4.30.0
Time: 4564ms
728x90