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?
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
andwebpack-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.mdI installed
webpack
andwebpack-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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With