2

Having installed the 'http-server' module using npm, I can only run it if I start powershell as admin.

eg:

npm install -g http-server

Seems to work fine, but then:

http-server

Throws the error:

http-server : The term 'http-server' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

However if I start powershell as an administrator, 'http-server' starts the server as expected.

How can I install the npm/node http-server to be available when powershell is not run as administrator?

Duplicate police: This is very similar to this question, but the problem is different (my install was global from the get go) and the solution there doesn't work for me unless run as admin.

Community
  • 1
  • 1
Andrew M
  • 9,149
  • 6
  • 44
  • 63

1 Answers1

1

Make sure your PATH environment variable includes the path to your http-server. You can do this in the user's powershell profile. You can find a basic introductory to powershell profiles here.

Roderick Bant
  • 1,534
  • 1
  • 9
  • 17