Node.JS NPM not working on Windows

2019-05-22 10:20发布

I just installed the latest version of nodejs, and while I can get it to run js files just fine, I can't get npm to do anything.

If I open the node.exe, it brings up a prompt, then I separately tried each of the following and none of them work:

> node npm install socket.io
> npm install socket.io
> help
> node help

ALL of the above result in nothing but the line "..." to be returned, then every thing I type in after that, I just get another line of "...".

This is extremely frustrating. What am I doing wrong?

2条回答
干净又极端
2楼-- · 2019-05-22 10:33

Opening node.exe will bring up the Read–eval–print loop (REPL). Try just:

c:\users\windowslogin>npm install socket.io
查看更多
兄弟一词,经得起流年.
3楼-- · 2019-05-22 10:45

If you had command prompt open whilst installing the latest nodejs then the path to npm in windows path will not be recognised until you close the command prompt and open a new one.

I know this already has an accepted answer but I just found this and then realised my own mistake and thought it might help someone else.

查看更多
登录 后发表回答