gpt4 book ai didi

javascript - npx 找不到模块 'webpack'

转载 作者:搜寻专家 更新时间:2023-11-01 00:20:01 25 4
gpt4 key购买 nike

我正在尝试测试自定义 Webpack 配置。我读过,我可以使用 npx webpack 而不是键入 node ./node_modules/webpack/bin/webpack.js。但我似乎无法让它工作。

user@comp:~/raw> npx webpack
The CLI moved into a separate package: webpack-cli.
Please install 'webpack-cli' in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D

当我切换到运行 npx webpack-cli 时,我得到了一个不同的错误:

user@comp:~/> npx webpack-cli
npx: installed 489 in 19.186s
Cannot find module 'webpack'

最佳答案

Please install 'webpack-cli' in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D

基本上就是这样。安装 webpack-cli 后,只需使用

npx webpack

关于javascript - npx 找不到模块 'webpack',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49595553/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com