如何使用“ npx webpack-cli init”

时间:2019-11-29 06:33:56

标签: webpack webpack-cli

mkdir demo & cd demo
npm init -y
npm i --save-dev webpack webpack-cli
npm i webpack-cli @webpack-cli/init
npx webpack-cli init

但是运行时

npx webpack-cli init

我得到了错误

init isn't a valid name.

It should be prefixed with 'webpack-scaffold', but have different suffix.

我该如何解决?

2 个答案:

答案 0 :(得分:4)

尝试使用@webpack-cli/init@0.2.2
0.3 https://github.com/webpack/webpack-cli/issues/1127有一些问题
同样在webpack-cli v4中,他们将init重命名为create

答案 1 :(得分:0)

使用npx webpack-cli create代替npx webpack-cli init