I have
var users1 = require('./users');
when I am trying to compile a file with this line : I am getting the Error:
undefined:2
�tobi�: {
^
SyntaxError: Unexpected token �
at Object.parse (native)
at Object..json (module.js:471:25)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object.<anonymous> (C:\node\XXXXXXX)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
I am really not getting what is the issuw with that line. It is a file names users.jason with json bodies
the content of the user.json is :
{
“tobi”: {
“password”: “xxxxxx”
}
}
should it be .json (or) json?
the users.js file has those special characters. You may only use the following characters for identifiers, and i quote http://mathiasbynens.be/notes/javascript-identifiers
An identifier must start with $, _, or any character in the Unicode categories “Uppercase letter (Lu)”, “Lowercase letter (Ll)”, “Titlecase letter (Lt)”, “Modifier letter (Lm)”, “Other letter (Lo)”, or “Letter number (Nl)”.
Have you tried redefining the �tobi� into something utf-8 like?
LATER EDIT:
The double quotes that you are using are wrong. Copy+paste and use these from now on: "