tj / js-yaml

CommonJS YAML Parser -- fast, elegant and tiny yaml parser for javascript
276 stars 41 forks source link

Parser error "has no method 'replace'" #51

Closed 0x80 closed 11 years ago

0x80 commented 11 years ago

yaml file:

environment: development logLevel: 5 foobar: wtf

js test:

var yaml = require('yaml'); var fs = require('fs');

fs.readFile('../config/development.yaml', function read(err, data) { if (err) throw err; console.log(data); // Put all of the code here (not the best solution) console.log(yaml.eval(data)); });

output:

has no method 'replace' at Object.exports.tokenize (/Users/me/node_modules/yaml/lib/yaml.js:75:19) at Object.exports.eval (/Users/me/node_modules/yaml/lib/yaml.js:384:30)

0x80 commented 11 years ago

Ugh nevermind I forgot the 'utf-8' encoding in readFile