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

Got an error in 1.4.11 - "Cannot read property 'name' of undefined" #153

Closed
minicuper opened this issue Jan 13, 2015 · 29 comments
Closed

Got an error in 1.4.11 - "Cannot read property 'name' of undefined" #153

minicuper opened this issue Jan 13, 2015 · 29 comments

Comments

@minicuper
Copy link

/home/zag2art/work/idg/node_modules/local-derby-server/node_modules/livedb-mongo/node_modules/mongoskin/lib/utils.js:33
  var skinClassName = 'Skin' + NativeClass.name;
                                          ^
TypeError: Cannot read property 'name' of undefined
  at makeSkinClass (/home/zag2art/work/idg/node_modules/local-derby-server/node_modules/livedb-mongo/node_modules/mongoskin/lib/utils.js:33:43)
  at Object.<anonymous> (/home/zag2art/work/idg/node_modules/local-derby-server/node_modules/livedb-mongo/node_modules/mongoskin/lib/admin.js:18:37)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/home/zag2art/work/idg/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/home/zag2art/work/idg/node_modules/local-derby-server/node_modules/livedb-mongo/node_modules/mongoskin/lib/db.js:20:17)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/home/zag2art/work/idg/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/home/zag2art/work/idg/node_modules/local-derby-server/node_modules/livedb-mongo/node_modules/mongoskin/lib/mongo_client.js:5:14)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/home/zag2art/work/idg/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at /home/zag2art/work/idg/node_modules/local-derby-server/node_modules/livedb-mongo/node_modules/mongoskin/lib/index.js:25:15
  at Array.forEach (native)
  at Object.<anonymous> (/home/zag2art/work/idg/node_modules/local-derby-server/node_modules/livedb-mongo/node_modules/mongoskin/lib/index.js:24:80)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/home/zag2art/work/idg/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/home/zag2art/work/idg/node_modules/local-derby-server/node_modules/livedb-mongo/node_modules/mongoskin/index.js:1:132)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/home/zag2art/work/idg/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/home/zag2art/work/idg/node_modules/local-derby-server/node_modules/livedb-mongo/mongo.js:2:17)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/home/zag2art/work/idg/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/home/zag2art/work/idg/node_modules/local-derby-server/server/store.js:10:17)
  at Object.<anonymous> (/home/zag2art/work/idg/node_modules/local-derby-server/server/store.js:114:4)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/home/zag2art/work/idg/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at module.exports (/home/zag2art/work/idg/node_modules/local-derby-server/server/index.js:61:13)
  at Object.derbyServer.run (/home/zag2art/work/idg/node_modules/local-derby-server/index.js:64:33)
  at module.exports (/home/zag2art/work/idg/src/server/index.coffee:19:22)
  at Object.<anonymous> (/home/zag2art/work/idg/server.js:13:26)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Function.Module.runMain (module.js:497:10)
  at startup (node.js:119:16)
  at node.js:902:3
@paulhill
Copy link

+1
Transitive dependency from agenda. Preventing our builds.

[TypeError: Cannot read property 'name' of undefined]
TypeError: Cannot read property 'name' of undefined
    at Object.<anonymous> (/home/.../kx/releases/api-server/api-server-release-2.37.1-1/node_modules/agenda/node_modules/mongoskin/lib/db.js:20:17)
    at Module._compile (module.js:456:26)

@tj
Copy link

tj commented Mar 24, 2015

still getting this as well

@vkarpov15
Copy link
Contributor

Can you clarify what version of the mongodb npm module you're using?

@tj
Copy link

tj commented Mar 24, 2015

we're using whatever monk pulls in: "mongoskin": "1.4.11"

@treywashington
Copy link

Having the same issue through monk.

@konstantine33
Copy link

I am having the same issue as well, through monk too.

@kimeshan
Copy link

Same issue here!

@ghost
Copy link

ghost commented Mar 24, 2015

+1 Same issue here width monk :
if it could help,

"dependencies": {
"mongoskin": "1.4.11",
"debug": "*",
"mpromise": "0.5.1"
},

and app dependencies :

"dependencies": {
"body-parser": "~1.0.0",
"cookie-parser": "~1.0.1",
"debug": "~0.7.4",
"express": "~4.0.0",
"jade": "~1.3.0",
"mongodb": "*",
"mongoose": "^3.8.25",
"monk": "^1.0.0",
"morgan": "~1.0.0",
"serve-favicon": "~2.1.3"
}

@kimeshan
Copy link

@sqone I got monk to work by changing the dependency to version "mongoskin": "1.3.20". Monk by default will install 1.4.11 which seems to be broken. The previous version of mongoskin (1.3.20) seems to be fine.

@iposton
Copy link

iposton commented Mar 24, 2015

@kimeshan can you clarify which dependencies you changed or better yet post your dependencies in the comments. Thank you!

@kimeshan
Copy link

@iposton I changed the mongoskin version in my monk dependencies:

This is in my package.json inside node_modules/monk:
"dependencies": {
"debug": "*",
"mongoskin": "^1.3.20",
"mpromise": "0.5.1"
}

Alternatively, just navigate to node_modules/monk in your shell, then do:
npm uninstall mongoskin --save
npm install mongoskin@1.3.20 --save

This will automatically change your mongoskin version and update the package.json.

This gets Monk to work. Monk requires Mongoskin and it seems that the latest push of Mongoskin is broken due to the NativeClass error here. So changing to 1.3.20 will tell npm to pull the previous working version of Mongoskin, which Monk can work with.

Hope that helps.

@iposton
Copy link

iposton commented Mar 24, 2015

@kimeshan I see. I changed the mongoskin to ^1.3.20 then did npm install but still getting same error. Is there a command to get npm to see the new change in monk?

@kimeshan
Copy link

@iposton I was having some problems with that too. I did the uninstall and then install, and that worked. Changing the package.json and then doing npm install didn't play nice when I tried it.

So uninstall mongoskin when you're inside node_modules/monk, then install by specifying the version with @.

npm uninstall mongoskin --save
npm install mongoskin@1.3.20 --save

@iposton
Copy link

iposton commented Mar 25, 2015

Yes! This solved my issue! Great work @kimeshan

no more error and the Server is now running on port 3000

@ar2rsawseen
Copy link

The issue is because mongoskin installs newest mongodb driver

"peerDependencies": {
    "mongodb": ">= 1.4"
  },

And the newest released mongodb drive is "version": "2.0.24"
which is not compatible with mongoskin anymore

So limiting dependency to

"peerDependencies": {
    "mongodb": "1.4.x"
  },

should fix the issue for now

@vkarpov15
Copy link
Contributor

1.4.13 uses "mongodb": "~1.4", see #159

vccabral added a commit to vccabral/monk that referenced this issue Nov 4, 2015
Install on heroku broken as per this discussion

kissjs/node-mongoskin#153
cantsin added a commit to cantsin/slack-request that referenced this issue Nov 19, 2015
@javlc
Copy link

javlc commented Jan 8, 2016

Got this error as well, did research and now I have a new, different error in node-gyp: Fatal error C1083:
More details in the following gist:
https://gist.github.com/javlc/67220256c6e51573dc07
Update: I created a stackoverflow question, if you may want to give it a try:
http://stackoverflow.com/q/34683791/1960071
Thanks.

@vkarpov15
Copy link
Contributor

@javlc not related to this issue. Also, mongoskin should work just fine even if the C++ bson build failed.

@statelo
Copy link

statelo commented Apr 18, 2016

@kimeshan Thank you so much! Installing mongoskin version 1.3.20 helped me to solve this problem!!

1 similar comment
@vikramparihar
Copy link

@kimeshan Thank you so much! Installing mongoskin version 1.3.20 helped me to solve this problem!!

@enn-code
Copy link

Downgrading is not really a great long term solution though. I'm new to Monk, is it outdated?

@statelo
Copy link

statelo commented May 1, 2016

@jaegerbombb yeah kind of like this...don`t forget that mongoskin version works with mongodb of version 1.4.x! that also helped me.

@ghost
Copy link

ghost commented May 15, 2016

@sylvainkossi
Thank you @iposton. I get the issue fixed now.

@asemoon
Copy link

asemoon commented May 31, 2016

What's the status of this issue? has it been fixed to work with latest version of mongo?

@Aparaxium
Copy link

I seem to be getting this error still.

@ivansf
Copy link

ivansf commented Jun 10, 2016

Getting the same issue. @kimeshan solution worked for me.

@statelo
Copy link

statelo commented Jun 21, 2016

Actually I don`t know does this method works...I just leaved this warning...The one thing which I did, the latest version of mongoskin is 1.0.1, so what you need it is just download mongodb of version 1.4.x because mongoskin version 1.0.1 only compatible with this mongodb version

@Aggie123
Copy link

1.4.13 uses "mongodb": "~1.4", see #159 works,
but still encounter further error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version
Find a solution to this FYI in case anyone need:

@memosngular
Copy link

I solved my issue with @kimeshan solution

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