Webpack-cli init not working

So I’m on the very last lecture of The Ultimate Javascript Series Part - 2, and the lecture is titled “Webpack”. I installed npm i -g webpack-cli@2.0.14 as intstructed, so far so good. Then I tried webpack-cli init and it’s giving me an error: TypeError: env.run(…).on is not a function.

Is anyone else having this problem???

Thanks,

1 Like

I found this in a search, it seems like a good solution. Did you ever figure it out?

No I got frustrated and moved on to the React Course. While looking at the link you just sent I tried using

  • webpack-cli 3.3.11
  • then npm install -D @webpack-cli/init@0.2.2
    and neither one of them worked for me. I could try the same versions of npm and node but I’m afraid that’ll screw up all my Node.JS files.

Have you thought about recreating the problem on a virtual machine? That way you have no worries about messing something up. Good luck. I’m slammed with homework, otherwise, I’d help you troubleshoot. Good luck!

Try this it fixed my issue.
npm i -g webpack-cli@3.3.2

3 Likes

Im facing the same issue

Have you been able to fix your issue. I’m having same.

Did anyone ever find a fix for this. I’m just finishing up the JS course
and I get snagged on the last freakin’ lesson. I’m getting a slew of errors
following the directions in the video. I’ve tried several different things
(I’m not sure if I’ve messed something up under the hood), but I got nothing.

I guess I’ll just be watching the last lecture and keep moving until I learn more
about webpack down the road.

If anyone finds a solution, please let me know.

Hang on a sec. I think I got it working. But please don’t quote me, I don’t know if it’s correct or not.

I didn’t end up using what Mosh showed in the original video.
First I entered:
npm install --save-dev webpack-cli

Then I entered:
npm audit fix
(To deal with vulnerabilities)

Next:
webpack-cli init

And when prompted with → Would you like to install ‘@webpack-cli/generators’ package? (That will run ‘npm install -D @webpack-cli/generators’) (Y/n)
I chose Y

I’m then prompted with the webpack questions, some were the same as in the video, but some weren’t. I guessed my way through some of the ones I wasn’t sure about (probably not best practice, but we’ll cross that bridge when we come to it :laughing: )

I hope that helps someone who’s stuck.

Looking for premium quality jackets with a wide range of varieties. Well, Right Jackets is the place you wanna be. We deal with jackets of all types. We intend to provide our customers with the most premium quality jackets like thatryan reynolds spirited jacket. So we make our jackets from pure materials.