为了账号安全,请及时绑定邮箱和手机立即绑定

运行 npm run build时报错

> todolist@1.0.0 build E:\work\todoList

> 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.

 - webpack-command (https://github.com/webpack-contrib/webpack-command)

   A lightweight, opinionated webpack CLI.

We will use "npm" to install the CLI via "npm install -D".

Which one do you like to install (webpack-cli/webpack-command):


One CLI needs to be installed alongside webpack to use the CLI.

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! todolist@1.0.0 build: `webpack --config webpack.config.js`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the todolist@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\Tom\AppData\Roaming\npm-cache\_logs\2018-06-01T07_54_45_313Z-debug.log


正在回答

8 回答

Which one do you like to install (webpack-cli/webpack-command):

提示输入时,输出webpack-cli即可

0 回复 有任何疑惑可以回复我~

楼主,解决了吗,可以分享下嘛

0 回复 有任何疑惑可以回复我~

解决了吗

0 回复 有任何疑惑可以回复我~

以上两个方法都试过了,没用

0 回复 有任何疑惑可以回复我~
#1

最不强程序员

我也是
2019-05-22 回复 有任何疑惑可以回复我~

在webpack.config.js文件添加

const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {

    //里面添加:

    plugins: [

        new VueLoaderPlugin()

    ]

}

这样就不会报错了

0 回复 有任何疑惑可以回复我~
#1

晨风不可依米

当然你也必须安装 webpack-cli
2019-01-07 回复 有任何疑惑可以回复我~

那个都没有起效


0 回复 有任何疑惑可以回复我~

webpack-cli和webpack-commond 选一个

0 回复 有任何疑惑可以回复我~

输入npm install webpack-cli -g或者npm install webpack-commond -g即可,必须加-g ,也就是全局安装,否则不行


1 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Vue+Webpack打造todo应用
  • 参与学习       84606    人
  • 解答问题       787    个

用前端最热门框架Vue+最火打包工具Webpack打造todo应用

进入课程

运行 npm run build时报错

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信