必须安装一个webpack的CLI-无法运行webpack

时间:2018-10-14 07:55:01

标签: npm webpack npm-install truffle

我一直在尝试卸载webpack(因为在运行它时,它会不断向我提供以下文本)

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):

我尝试了什么?

- Installed webpack-cli
- Installed webpack-command
- $env:NODE_ENV="production" --> $env:NODE_ENV="dev" or $env:NODE_ENV="development"
- npm uninstall webpack 
- npm uninstall webpack  --save
- npm uninstall webpack  --save-dev
- npm -g uninstall webpack  --save
- npm install yarn // to see if webpack could be installed via yarn
- Installed back webpack several times
- $ npm cache clean --force at several points in between to see if cache was the issue.

我想做什么?

我想使用webpack构建我的Truffle应用

3 个答案:

答案 0 :(得分:2)

尝试了所有方法后,它无法直接运行,所以我通过它完成了操作

npm run build

该版本正在调用webpack,并且它以这种方式工作。

答案 1 :(得分:1)

我解决了将webpack移至devDependencies

的问题
    npm install webpack --save-dev 

答案 2 :(得分:0)

在终端中尝试使用新版本的webpack下一个命令: $ npx webpack