javascript - npx cannot find module 'webpack' - Stack Overflow

I'm trying to test a custom Webpack configuration. I've read that instead of typing node .no

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

    发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745159399a4614319.html

相关推荐

  • javascript - npx cannot find module 'webpack' - Stack Overflow

    I'm trying to test a custom Webpack configuration. I've read that instead of typing node .no

    12小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信