I am Learning React.js and i am using windows 8 OS.i have navigate to my root folder
1.Created the package.json file by npm init
2. install webpack by npm install -S webpack.now webpack has been downloaded to my modules folder
3. install webpack globally by typing npm install webpack -g
4. i am also having a webpack.config.js in my root folder which contains the source and ouput directory
5. when i type the webpack command i am getting the below error.
webpack is not recognized as a internal or external command,operable program or batch file
npm install -g webpack-dev-server
will solve your issueWebpack CLI is now in a separate package and must be installed globally in order to use the 'webpack' command:
EDIT: Much has changed. Webpack folks do not recommend installing the CLI globally (or separately for that matter). This issue should be fixed now but the proper install command is:
This answer was originally intended as a "work-around" for the OPs problem.
I've had same issue and just added the code block into my package.json file;
and then run command on terminal;
Just run your command line (cmd) as an administrator.
I had this issue when upgrading to React 16.12.0.
I had two errors one regarding webpack and the other regarding the store when rendering the DOM.
Webpack Error:
Webpack Solution:
node_modules
folderpackage-lock.json
npm install
npm rebuild
Store Error:
Store Solution:
Suggestions to update my React version didn't fix this error for me, but irrespective I would recommend doing it.
My code ended up looking like this:
As per this solution
As an alternative, if you have Webpack installed locally, you can explicitly specify where Command Prompt should look to find it, like so:
(This does assume that you're inside the directory with your
package.json
and that you've already runnpm install webpack
.)