재우니의 블로그

Cannot find module 'webpack-cli/bin/config-yargs' 오류메시지

 

 

 

npm run dev 를 실행했더니... Cannot find module 'webpack-cli/bin/config-yargs' 오류메시지가 나옵니다.

 

simjaeun-ui-MacBook-Air:todolistapp01 simjaeun$ npm run dev



> todolistapp@1.0.0 dev /Users/simjaeun/Desktop/vue/vuejs_book/ch11/todolistapp01

> cross-env NODE_ENV=development webpack-dev-server --open --hot



The CLI moved into a separate package: webpack-cli

Please install 'webpack-cli' in addition to webpack itself to use the CLI

-> When using npm: npm i -D webpack-cli

-> When using yarn: yarn add -D webpack-cli

internal/modules/cjs/loader.js:582

    throw err;

    ^



Error: Cannot find module 'webpack-cli/bin/config-yargs'

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

    at Function.Module._load (internal/modules/cjs/loader.js:506:25)

    at Module.require (internal/modules/cjs/loader.js:636:17)

    at require (internal/modules/cjs/helpers.js:20:18)

    at Object.<anonymous> (/Users/simjaeun/Desktop/vue/vuejs_book/ch11/todolistapp01/node_modules/webpack-dev-server/bin/webpack-dev-server.js:84:1)

    at Module._compile (internal/modules/cjs/loader.js:688:30)

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

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

    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)

    at Function.Module._load (internal/modules/cjs/loader.js:529:3)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! todolistapp@1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the todolistapp@1.0.0 dev 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!     /Users/simjaeun/.npm/_logs/2018-12-02T15_36_30_979Z-debug.log

simjaeun-ui-MacBook-Air:todolistapp01 simjaeun$ npm install

npm WARN ajv-errors@1.0.0 requires a peer of ajv@>=5.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN webpack-dev-middleware@3.4.0 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN webpack-dev-server@3.1.10 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.



audited 9049 packages in 10.914s

found 0 vulnerabilities

 

 

 

webpack 과 webpack-dev-server 버전이 서로간 충돌로 인해서 아래와 같이 버전을 맞춰 주면 됩니다.

설치가 안되면 관리자 권한 sudo 를 통해 실행하시면 됩니다.

 

 

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

 

실행 후,...

 

"devDependencies": {
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-latest": "^6.0.0",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"vue-loader": "^12.1.0",
"vue-template-compiler": "^2.3.3",
"webpack": "^3.8.0",
"webpack-dev-server": "^2.9.7"
}

 

 

이제 npm run dev 실행하면 오류 없이 작동 됩니다.