I want to start a simple local webserver for local development on Windows 7. For this I installed node.js and then ran:
npm install -g local-web-server
Next I went to the folder D:\[path_to_webcontent]
containing the index.html
, started a cmd-prompt from that folder and ran:
node ws
and get the error:
module.js:338
throw err;
^ Error: Cannot find module 'D:[path_to_webcontent]\ws'
Why can't node find the globally installed webserver?
The module "local-web-server" is located at C:\Users\<user>\AppData\Roaming\npm\node_modules
.
Instead of node ws
you just type ws
in the cmd-prompt.
From the documentation on npm (https://www.npmjs.com/package/local-web-server):
$ npm install -g local-web-server
$ ws
When you write node ws
node is looking to run a module called ws
. When you want to use a globally installed package you just need to use the package's name in the cmd-prompt.