admin管理员组文章数量:1414614
I'm trying to test a custom Webpack configuration. I've read that instead of typing node ./node_modules/webpack/bin/webpack.js
, I can use npx webpack
. But I can't seem to get it to work.
user@p:~/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
When I switch to running npx webpack-cli
, I get a different error:
user@p:~/> npx webpack-cli
npx: installed 489 in 19.186s
Cannot find module 'webpack'
I'm trying to test a custom Webpack configuration. I've read that instead of typing node ./node_modules/webpack/bin/webpack.js
, I can use npx webpack
. But I can't seem to get it to work.
user@p:~/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
When I switch to running npx webpack-cli
, I get a different error:
user@p:~/> npx webpack-cli
npx: installed 489 in 19.186s
Cannot find module 'webpack'
Share
Improve this question
asked Apr 1, 2018 at 6:50
LiziLizi
691 silver badge3 bronze badges
7
- Have you installed both webpack and webpack-cli? – Agney Commented Apr 1, 2018 at 6:51
-
Can you double-check if you're in a directory with a
package.json
(or that Webpack is installed globally and linked)? – Atav32 Commented Apr 1, 2018 at 6:53 -
The instructions on the first error message say precisely what you should do here:
npm install webpack-cli -D
. Reading error messages is important本文标签: javascriptnpx cannot find module 39webpack39Stack Overflow
版权声明:本文标题:javascript - npx cannot find module 'webpack' - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745159398a2645370.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论