请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

在配置webpack时,npm run build 提示要安装webpack-cli ,可是按照webpackcli报错,是怎么回事

D:\zhouWork\zhou-vue-learn>npm run build

zhou-vue-learn@1.0.0 build D:\zhouWork\zhou-vue-learn
webpack --config webpack.config.js

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): no
    You need to install ‘webpack-cli’ to use webpack via CLI.
    You can also install the CLI manually.
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! zhou-vue-learn@1.0.0 build: webpack --config webpack.config.js
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the zhou-vue-learn@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\Administrator\AppData\Roaming\npm-cache_logs\2019-01-25T14_05_39_493Z-debug.log

D:\zhouWork\zhou-vue-learn>npm run build

zhou-vue-learn@1.0.0 build D:\zhouWork\zhou-vue-learn
webpack --config webpack.config.js

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): yes
    Installing ‘webpack-cli’ (running ‘npm install -D webpack-cli’)…
    npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EPROTO: request to https://registry.npmjs.org/global-modules failed, reason: write EPROTO 101057795:error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number:openssl\ssl\s3_pkt.c:365:\n
    npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
    npm ERR! Unexpected end of JSON input while parsing near ‘…gistry.npmjs.org/v8-c’

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2019-01-25T14_07_25_645Z-debug.log
undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zhou-vue-learn@1.0.0 build: webpack --config webpack.config.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zhou-vue-learn@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\Administrator\AppData\Roaming\npm-cache_logs\2019-01-25T14_07_26_075Z-debug.log

正在回答 回答被采纳积分+3

1回答

Jokcy 2019-01-26 16:28:13

你安装的webpack4,所以需要安装webpack-cli配合使用,课程中用的是webpack3,所以没有这个要求。

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号