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
评论列表(0条)