Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot find module '.../webpack'

I'm just starting with node, and server stuff in general. I was following along with a well-reviewed youtube video and am at a loss here. I installed webpack and webpack-dev-server both globally and in my project folder. Now if I try to run webpack (typing nodejs webpack in the terminal) or webpack-dev-server, it just give me this error:

andrew@AndrewLaptop:~/Documents/mean-todo-app$ nodejs webpack

module.js:340
    throw err;
          ^
Error: Cannot find module '/home/andrew/Documents/mean-todo-app/webpack'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

Shoudln't it be looking in mean-todo-app/node_modules/webpack instead of mean-todo-app/webpack?

Again, new to all of this so I could be missing something stupid, but I did search to no avail.

Thanks

edit: guess I could have mentioned I'm on Ubuntu if that matters

like image 733
Andrew Avatar asked Apr 04 '16 03:04

Andrew


1 Answers

try using

npm install webpack

and do this in the root directory of your app.

like image 183
Rutvij Dhotey Avatar answered Sep 22 '22 04:09

Rutvij Dhotey