Bomin Bomin - 1 year ago 282
Node.js Question

NPM live-server

Here's the server I'm using, However, when I try to use

as the configuration file, I always fail... Here's what I have in the file, and it's very simple.

port: "8001"

Then I have this error when I run

port: "8001"

SyntaxError: Unexpected token p
at Object.parse (native)
at Object.<anonymous> (/usr/local/lib/node_modules/live-server/live-server.js:17:20)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:136:18)
at node.js:963:3

Don't know why this is happening.

Answer Source

Property names in JSON must be quoted (JSON is not JavaScript):

   "port": "8001"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download