Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webpack-dev-server errors with "command not found: webpack-dev-server"

don't really see why I can't get this to run... I've done the following.

npm install -g webpack webpack-dev-server

confirmed that both installed successfully.

Now, when I try and execute webpack-dev-server, I get the following:

$ webpack-dev-server --inline --hot
zsh: command not found: 'webpack-dev-server'

Never run into this as all my other npm modules load/run fine, both locally and globally. I've tried installing it locally to a project as well (adding to package.json, npm install, yadda yadda..) and receive the same error.

Am I missing something?

like image 406
tdc Avatar asked Nov 16 '15 21:11

tdc


1 Answers

Found a solution as per this answer on GitHub:

I was able to solve this problem on my machine. It appears to have been an issue with permissions.

I installed webpack and webpack-dev-server globally. However, even then, $ webpack-dev-server resulted in command not found (as stated above).

The problem was that npm installed the global packages to /usr/local/lib/node_modules which required root permissions.

In order to avoid having to use root permissions, I changed the directory in which global packages are to be installed to a directory in $HOME. To do this, I followed this guide: https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md

I installed webpack and webpack-dev-server globally again (this time without sudo) and verified that they have been installed in my new directory.

Now, I can finally run $ webpack-dev-server.

like image 51
tdc Avatar answered Sep 28 '22 08:09

tdc