Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX does not work #21

Closed
cromestant opened this issue Dec 4, 2015 · 2 comments
Closed

OSX does not work #21

cromestant opened this issue Dec 4, 2015 · 2 comments

Comments

@cromestant
Copy link

I have a simple sample code taken from the documentation:
test.js

var avsc = require('avsc');
    var type = avsc.parse('./schemas/pet.avsc')
    var pet = {kind: 'CAT', name: 'my cat'}
    var buf = type.toBuffer(pet); // Serialized object.
    var obj = type.fromBuffer(buf); // {kind: 'CAT', name: 'Albert'}

    console.log(buf)
    console.dir(obj)

And a simple avsc file in schemas/peg.avsc

{
  "name": "Pet",
  "type": "record",
  "fields": [
    {"name": "kind", "type": {"name": "Kind", "type": "enum", "symbols": ["CAT", "DOG"]}},
    {"name": "name", "type": "string"}
  ]
}

on ubuntu, running node test.js I get:

cromestant@tweb-lab-web-01:~/test$ node test.js 
< Buffer 00 0c 6d 79 20 63 61 74>
{ kind: 'CAT', name: 'my cat' }

however con El Capitán:

Charles-Romestant-MacBook-Air:activity cromestant$ node test.js 
/Users/cromestant/Codigos/node/activity/test.js:4
var buf = type.toBuffer(pet); // Serialized object.
               ^

TypeError: type.toBuffer is not a function
    at Object. (/Users/cromestant/Codigos/node/activity/test.js:4:16)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:138:18)
    at node.js:974:3

important version & stuff

Charles-Romestant-MacBook-Air:activity cromestant$ node --version
v5.1.1
Charles-Romestant-MacBook-Air:tigo-activity cromestant$ cat node_modules/avsc/package.json 
{
  "_args": [
    [
      "avsc@^1.0.2",
      "/Users/cromestant/Codigos/node/tigo-activity"
    ]
  ],
  "_from": "avsc@>=1.0.2 <2.0.0",
  "_id": "avsc@1.0.2",
  "_inCache": true,
  "_installable": true,
  "_location": "/avsc",
  "_nodeVersion": "4.1.0",
  "_npmUser": {
    "email": "monsch@alum.mit.edu",
    "name": "mtth"
  },
  "_npmVersion": "2.14.3",
  "_phantomChildren": {},
  "_requested": {
    "name": "avsc",
    "raw": "avsc@^1.0.2",
    "rawSpec": "^1.0.2",
    "scope": null,
    "spec": ">=1.0.2 <2.0.0",
    "type": "range"
  },
  "_requiredBy": [
    "/"
  ],
  "_resolved": "https://registry.npmjs.org/avsc/-/avsc-1.0.2.tgz",
  "_shasum": "aa9369896e0d1ea5e63fd74b3857df21fc61f86a",
  "_shrinkwrap": null,
  "_spec": "avsc@^1.0.2",
  "_where": "/Users/cromestant/Codigos/node/tigo-activity",
  "author": {
    "name": "Matthieu Monsch"
  },
  "bugs": {
    "url": "https://github.com/mtth/avsc/issues"
  },
  "dependencies": {},
  "description": "A serialization API to make you smile",
  "devDependencies": {
    "coveralls": "^2.11.4",
    "istanbul": "^0.3.19",
    "mocha": "^2.3.2"
  },
  "directories": {},
  "dist": {
    "shasum": "aa9369896e0d1ea5e63fd74b3857df21fc61f86a",
    "tarball": "http://registry.npmjs.org/avsc/-/avsc-1.0.2.tgz"
  },
  "engines": {
    "node": ">=0.11"
  },
  "files": [
    "lib"
  ],
  "gitHead": "75c09c68b5dc5a0510a5ebede5ce80f00e3e6aec",
  "homepage": "https://github.com/mtth/avsc",
  "keywords": [
    "avro",
    "avsc",
    "decoding",
    "encoding",
    "json",
    "schema"
  ],
  "license": "MIT",
  "main": "./lib",
  "maintainers": [
    {
      "name": "mtth",
      "email": "monsch@alum.mit.edu"
    }
  ],
  "name": "avsc",
  "optionalDependencies": {},
  "readme": "ERROR: No README data found!",
  "repository": {
    "type": "git",
    "url": "git://github.com/mtth/avsc.git"
  },
  "scripts": {
    "bench": "python benchmarks >timings.json",
    "cover": "istanbul cover _mocha -- --ui tdd",
    "test": "mocha --ui tdd"
  },
  "version": "1.0.2"
}
@mtth
Copy link
Owner

mtth commented Dec 4, 2015

Thanks for the detailed info. From the package.json it seems your OS X install is using an old version of avsc (1.0.2). Upgrading to the current version (3.1.1) should fix this. Let me know if not.

@mtth mtth closed this as completed Dec 4, 2015
@cromestant
Copy link
Author

you were absolutely right.
weird thing is that I have no idea why I specified the version that old...
thanks and sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants