0
votes

I am new to nodeJs:

I have written down server.js file, I installed nodejs. when I am running "npm start" I am getting following errors.

C:\Users\server\server.js:43
if (!(req.headers && req.headers.authorization)) {

                    ^                                                                                                                           SyntaxError: Unexpected token ;                                       

at exports.runInThisContext (vm.js:73:16)                                                                                                      
at Module._compile (module.js:443:25)                                                                                                          
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)                                                                                                  
at startup (node.js:129:16)                                                                                                                    
at node.js:814:3                                                                                                                               
                                                                                                                                                npm ERR! Windows_NT 6.1.7601                                          

npm ERR! argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node server.js'. npm ERR! This is most likely a problem with the der-server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls der-server
npm ERR! There is likely additional logging output above.

                                                                                                                                                npm ERR! Please include the following file with any support request:  

npm ERR! C:\Users\server\npm-debug.log

1

1 Answers

2
votes

You code is showing the && as escaped characters. That is not valid JavaScript.