Skip to content

Instantly share code, notes, and snippets.

@jed
Created April 18, 2011 03:43
Show Gist options
  • Save jed/924775 to your computer and use it in GitHub Desktop.
Save jed/924775 to your computer and use it in GitHub Desktop.
"TypeError: Cannot convert object to primitive value"
$ node test.js
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot convert object to primitive value
at String.STRING_ADD_LEFT (native)
at isRegExp (util.js:287:14)
at format (util.js:184:11)
at util.js:216:19
at Array.map (native)
at format (util.js:193:23)
at util.js:216:19
at Array.map (native)
at format (util.js:193:23)
at util.js:216:19
a = []
a.unshift( global )
console.log( a )
@balupton
Copy link

I'm getting this too. Did you come up with a solution?

@svnlto
Copy link

svnlto commented Oct 12, 2011

did you ever get this to work? Having the same issue..

@jed
Copy link
Author

jed commented Oct 12, 2011

this was fixed a long time ago by @koichik if i recall correctly.

node -e "a=[];a.unshift(global);a"

works for me now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment