포장 웹팩 명령을 사용하는 경우, 오류 형식 오류 : 정의되지 않은 솔루션의 특성 'presetToOptions'을 읽을 수 없습니다

난 그냥 설치 웹팩, 웹팩-CLI 설치되지 않은, 처음 웹팩 포장를 입력, 조언,

One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:
 - webpack-cli (https://github.com/webpack/webpack-cli)
   The original webpack full-featured CLI.
We will use "npm" to install the CLI via "npm install -D".
Do you want to install 'webpack-cli' (yes/no): 

예 오류를 입력

Error: Cannot find module 'webpack-cli'
Require stack:
- C:\Users\Administrator\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)
    at Function.Module._load (internal/modules/cjs/loader.js:677:27)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js:143:5
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\webpack\\bin\\webpack.js'
  ]
}

해결 방법 : 웹팩-CLI -g 글로벌 설치 웹팩-CLI 설치 명령 NPM을 입력
포장, 새로운 오류 웹팩 명령을 다시 실행

F:\myweb\alice\vue\vue-cms\node_modules\webpack-cli\bin\cli.js:137
                        const statsPresetToOptions = require("webpack").Stats.presetToOptions;
                                                                             ^

TypeError: Cannot read property 'presetToOptions' of undefined
    at processOptions (F:\myweb\alice\vue\vue-cms\node_modules\webpack-cli\bin\cli.js:137:57)
    at F:\myweb\alice\vue\vue-cms\node_modules\webpack-cli\bin\cli.js:364:3
    at Object.parse (F:\myweb\alice\vue\vue-cms\node_modules\webpack-cli\node_modules\yargs\yargs.js:567:18)
    at F:\myweb\alice\vue\vue-cms\node_modules\webpack-cli\bin\cli.js:49:8
    at Object.<anonymous> (F:\myweb\alice\vue\vue-cms\node_modules\webpack-cli\bin\cli.js:366:3)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at module.exports (C:\Users\Administrator\AppData\Roaming\npm\node_modules\webpack-cli\node_modules\import-local\index.js:16:66)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\webpack-cli\bin\cli.js:15:6
    at Object.<anonymous> (C:\Users\Administrator\AppData\Roaming\npm\node_modules\webpack-cli\bin\cli.js:366:3)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at Object.<anonymous> (C:\Users\Administrator\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js:156:2)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
    at internal/main/run_main_module.js:17:11

해결 방법 : 오류 메시지에 따라 개방 node_modules는 \ 웹팩-CLI \ 빈 \의 cli.js, 라인 (137)의 CONST statsPresetToOptions의 =은 ( "웹팩"필요 ) Stats.presetToOptions, 삭제이 중간 통계의 제목을 ...
성공 웹팩을 저장 한 후 다시 실행!

추천

출처www.cnblogs.com/zhahuhu/p/11780576.html