jdx / mean-sample

Sample project for Write Modern Web Apps with the MEAN Stack by Jeff Dickey
https://mean-sample.herokuapp.com
166 stars 90 forks source link

wscat command doesn't work #12

Closed nivaruofficial closed 9 years ago

nivaruofficial commented 9 years ago

After running wscat -c ws://localhost:3000 i receive the following message:

-bash: wscat: command not found

I've installed ws module locally and globally, but it doesn't recognize the command!

jdx commented 9 years ago

do your other node commands work? might need to put this on the ws project

nivaruofficial commented 9 years ago

Yes, other commands work, strange..

nivaruofficial commented 9 years ago

so, any idea? :octopus:

jdx commented 9 years ago

sorry, I don't know

edwallitt commented 9 years ago

Try npm install -g wscat and make sure that your PATH is setup correctly. I had the same issue and this solved it for me.

scarrick68 commented 9 years ago

edwallitt is right. I did sudo npm install --save wscat and it installed a package, but still didn't work. You need to sudo npm install -g wscat.

jdx commented 9 years ago

you should fix your box such that you don't have to use sudo

scarrick68 commented 9 years ago

Thanks for the tip. I thougt this book was pretty good and really helped me get a better understanding of how all the pieces in the stack work together as well as how to streamline my dev environment. one suggestion I would make is to put a link to the corresponding github page at the beginning of each chapter. I had a way easier time following along once I was using your repo with the book. It also gets a little disjoint starting in chapter 7. Beginners aren't gonna know to do anything you don't explicitly tell them and I noticed code in the github pages that wasn't mentioned in the book. You should make it really clear when you do something that isn't explicitly shown in the book. There are a few times when you give options or mention other possibilities, but don't state which one is gonna be used going forward and then some code i've never seen just appears in the repo.

On Mon, Jan 26, 2015 at 10:32 AM, Jeff Dickey notifications@github.com wrote:

you should fix your box such that you don't have to use sudo

— Reply to this email directly or view it on GitHub https://github.com/dickeyxxx/mean-sample/issues/12#issuecomment-71478534 .

mark-leone commented 9 years ago

I installed ws globally and locally on two different CentOS systems and an OSX system. In each instance it does not install the wscat binary anywhere. I looked specifically in the global node_modules installation directory, and the local node_modules installation directory, and I did a global search. The wscat binary is nowhere. And yes, I used sudo also.

jdx commented 9 years ago

npm should install it like this: https://docs.npmjs.com/files/package.json#bin

nothing looks misconfigured in the wscat package.json

mark-leone commented 9 years ago

Well there's the problem. I was doing npm install ws, because this site (https://einaros.github.io/ws/) says that you install ws and it includes the executable wscat, or at least that's the way it reads to me. I didn't notice that on this thread people were saying to install wscat, until I saw you referencing the wscat package.json.

So now it works. Thanks

tjunghans commented 8 years ago

@mark-leone Thanks for the tip. I was having the same issue wondering what I was missing. The documentation on http://websockets.github.io/ws/ is still outdated.

interglobalmedia commented 7 years ago

For anyone who is interested, I had the same problem, but figured out a very simple solution. I did a local install of wscat, and then used the following command: node_modules/.bin/wscat -c ws://localhost:3001 in order to connect to my WebSockets server. Works beautifully. In other words, even though it states on the wscat page on npmjs.com that it is necessary to install it globally, it is NOT. Hope this helps! FYI, this was not for the mean sample, but it still should apply across the board.

edujose35 commented 3 years ago

For anyone who is interested, I had the same problem, but figured out a very simple solution. I did a local install of wscat, and then used the following command: node_modules/.bin/wscat -c ws://localhost:3001 in order to connect to my WebSockets server. Works beautifully. In other words, even though it states on the wscat page on npmjs.com that it is necessary to install it globally, it is NOT. Hope this helps! FYI, this was not for the mean sample, but it still should apply across the board.

This worked for me