How to fix error when executing webpack command from Node js?

0

I try to run the webpack command to compile an application in react js, previously I worked in ubuntu and it worked perfectly and I changed to windows and when using node js in windows, it generates the following message that does not allow me to compile

** The CLI moved to a separate package: webpack-cli would you like to install webpack-cli? **

and I try to install it by entering the option (yes) and nothing happens, I run the same command again and it comes back and it shows me the message again

    
asked by Jhon Dember Murillo Mendez 27.04.2018 в 19:56
source

2 answers

1

It is exactly what the message tells you, to be able to use it from the webpack console, from version 4, it is necessary to install the package webpack-cli which is the one that contains the functionality related to the command line.

If you have webpack installed globally, use

npm install -g webpack-cli

but replace the -g parameter with --save-dev

    
answered by 27.04.2018 в 23:39
0

What I can think of is that you try the following:

1.- Install webpack manually

npm install --save-dev webpack

npm install -g webpack-cli

2.- try again and if it does not work for you it would be good if you delete the folder node_modules and re-run npm install

3.- Possibly your webpack.config.js file is failing, it would be very useful if you can show your configuration to make it easier to identify your problem.

4.- If you were not the one who used webpack-cli explicitly, look for the package trying to call webpack-cli and see if it is necessary to do so.

    
answered by 27.04.2018 в 22:56