webpack is not recognized as a internal or externa

2020-01-26 04:17发布

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 webpack
22条回答
我只想做你的唯一
2楼-- · 2020-01-26 04:36

Try this folks, the cli needs to be updated to the latest version

npm install --save-dev @angular/cli@latest

credit goes go to R.Richards https://stackoverflow.com/a/44526528/1908827

查看更多
Bombasti
3楼-- · 2020-01-26 04:37
npx webpack

It is worked for me. I'm using Windows 10 and I installed webpack locally.

查看更多
相关推荐>>
4楼-- · 2020-01-26 04:38

If you have just cloned a repo, you first need to run

npm install

The error your getting will be generated if you are missing project dependencies. The above command will download and install them.

查看更多
相关推荐>>
5楼-- · 2020-01-26 04:40

Try deleting node_modules in local directory and re-run npm install.

查看更多
放荡不羁爱自由
6楼-- · 2020-01-26 04:41

Maybe a clean install will fix the problem. This "command" removes all previous modules and re-installs them, perhaps while the webpack module is incompletely downloaded and installed.

npm clean-install
查看更多
Explosion°爆炸
7楼-- · 2020-01-26 04:45

I had this same problem and I couldn't figure it out. I went through every line of code and couldn't find my error. Then I realized that I installed webpack in the wrong folder. My error was not paying attention to the folder I was installing webpack to.

查看更多
登录 后发表回答