0

I am trying to install the http-server, bower, grunt in my windows machine. I tried to install using npm install the install is successful but when, i try to run the command it is saying command not found. I tried closing the command prompt and execute again. Same result. The file are available in appdata folders.

C:\Users\testuser>npm install http-server
+ http-server@0.11.1
updated 1 package in 5.713s

C:\Users\testuser>http-server
'http-server' is not recognized as an internal or external command,
operable program or batch file.

I tried listing the services and the service is installed

C:\Users\testuser>npm list -g --depth=0
C:\Users\testuser\AppData\Roaming\npm
+-- bower@1.8.4
+-- http-server@0.11.1
`-- json-server@0.12.1

I tried searching for similar issues, but could not find the same.

Sergey
  • 448
  • 1
  • 4
  • 16
Harry
  • 445
  • 3
  • 11
  • 28
  • Read https://stackoverflow.com/questions/15054388/global-node-modules-not-installing-correctly-command-not-found – Saeed Apr 22 '18 at 07:58

1 Answers1

0
 npm install http-server -g

This will install http-server globally so that it may be run from the command line.

Fateme Fazli
  • 11,582
  • 2
  • 31
  • 48
  • @Harry are the locations of both npm and http-server added in environment variable 'PATH' (Both user variable and System variable)? – Fateme Fazli Apr 20 '18 at 09:51
  • npm, npm bin was added, usually npm install will take care because your npm bin directory is already available in path. I re-installed npm and then npm install http-server, it is working as expected. May be my repository got corrupted. – Harry Apr 24 '18 at 15:19