I am trying to run samples regarding webrtc. For that I went to
At step 5 I needed to run server.js. For that I opened my Windows Command prompt and entered:
C:\Program Files\nodejs>node D:\GITProjects\codelab\plete\step5\server.js
But I got this error:
module.js:338
throw err;
^ Error: Cannot find module 'node-static'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (D:\GITProjects\codelab\plete\step5\server.js:1:76)
at Module._pile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
I have already installed node-static module and it is present at
"C:\Program Files\nodejs\node_modules\node-static"
Still I am getting the error "Cannot find module 'node-static'".
Environmental "PATH" variable is set to "C:\Users\user\AppData\Roaming\npm"
I can see the node-static folder is present at "C:\Users\user\AppData\Roaming\npm\node_modules\node-static" path too.
Edit:
Based on the ments I tried this on Windows Command Prompt to install node-static:
C:\Program Files\nodejs>npm install node-static -g
I got this as the output:
C:\Users\user\AppData\Roaming\npm\static -> C:\Users\user\AppData\Roaming\np
m\node_modules\node-static\bin\cli.js
[email protected] C:\Users\user\AppData\Roaming\npm\node_modules\node-static
├── [email protected]
├── [email protected]
└── [email protected] ([email protected], [email protected])
Can you help me location the cause of my issue?
I am trying to run samples regarding webrtc. For that I went to
https://bitbucket/webrtc/codelab/src/50a47bb092483fd7ca27998a365dff434919bf89?at=master
At step 5 I needed to run server.js. For that I opened my Windows Command prompt and entered:
C:\Program Files\nodejs>node D:\GITProjects\codelab\plete\step5\server.js
But I got this error:
module.js:338
throw err;
^ Error: Cannot find module 'node-static'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (D:\GITProjects\codelab\plete\step5\server.js:1:76)
at Module._pile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
I have already installed node-static module and it is present at
"C:\Program Files\nodejs\node_modules\node-static"
Still I am getting the error "Cannot find module 'node-static'".
Environmental "PATH" variable is set to "C:\Users\user\AppData\Roaming\npm"
I can see the node-static folder is present at "C:\Users\user\AppData\Roaming\npm\node_modules\node-static" path too.
Edit:
Based on the ments I tried this on Windows Command Prompt to install node-static:
C:\Program Files\nodejs>npm install node-static -g
I got this as the output:
C:\Users\user\AppData\Roaming\npm\static -> C:\Users\user\AppData\Roaming\np
m\node_modules\node-static\bin\cli.js
[email protected] C:\Users\user\AppData\Roaming\npm\node_modules\node-static
├── [email protected]
├── [email protected]
└── [email protected] ([email protected], [email protected])
Can you help me location the cause of my issue?
Share Improve this question edited Jul 14, 2015 at 12:47 Raghav asked Jul 14, 2015 at 12:31 RaghavRaghav 9,6286 gold badges89 silver badges115 bronze badges 5-
Could you please try installing node-static globally in the mand line:
npm install node-static -g
. Let me know if that helps at all. – Alexander Staroselsky Commented Jul 14, 2015 at 12:43 - Or try to install using npm install node-static --save-dev – Laxmikant Dange Commented Jul 14, 2015 at 12:44
- Answer edited. Ran :npm install node-static -g:. Ran both mands but still the same error. – Raghav Commented Jul 14, 2015 at 12:48
- Solution I found: Run Node.js mand prompt instead of Windows Command prompt. Cd to the root directory where package.json is, in my case "D:\GITProjects\codelab\plete>npm install" – Raghav Commented Jul 14, 2015 at 14:12
- you and I literally are going through the same tutorial, except 6 mo's apart... crazy. internet brain twins. Thanks for asking this question, helpful for me. – Eleanor Zimmermann Commented Jan 28, 2016 at 2:16
2 Answers
Reset to default 2node_static
is not an inbuilt nodejs module so there should be a folder node_modules
in your doc root folder(step5) with this module in it or create a package.json
and list it as a dependency then run npm install
before node server.js
just run npm install
on cd into the "plete" directory i.e codelab\plete