-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Uncaught TypeError: Cannot read property 'prototype' of undefined #7173
Comments
The fix for this issue: #7102 seems to have been what introduces this bug. There is no Buffer property on global when NodeBuffer gets created. |
thanks my friend |
Why did you close this Issue? It's not fixed. This should be an open issue. |
@nikdunn does 5.3.6 fix the issue for you? |
No, @lineus , 5.3.6 is where the issue is introduced. I was using 5.3.4 and then an npm install bumped me to 5.3.6 where I started experiencing the issue. |
this issue was introduced in @5.3.5 I am able to replicate this using a new vue-cli@2.9.6 webpack app and just adding the mongoose import statement I am also able to repro this using create-react-app and mongoose@5.3.{5,6}. |
@nikdunn sorry that I didn't quite familar with github issues,@lineus has opened this already |
Thanks for helping us find this issue. We started using the core node buffer for a couple use cases to work around a bug in safe-buffer (feross/safe-buffer#23) . |
fixes #7173 fallback to safe-buffer in the browser
I´m getting the same error on a Jest test suite:
Any toughts on how to fix it? |
@odelucca can you provide code samples? The original issue had nothing to do with jest and jest has a lot of issues. If you're going to use jest, make sure you read this doc: https://mongoosejs.com/docs/jest.html |
@vkarpov15 thanks for the reply. I found out that the issue wasnt with mongoose :) Thanks! |
What is the current behavior?
I just import mongoose in a project that initialized by vue-cli 2.0,when I run the project ,an error thrown as the title said,can anyone explain why?thanks!!
here is the detail of error:
Uncaught TypeError: Cannot read property 'prototype' of undefined
at eval (webpack-internal:///./node_modules/mongoose/lib/types/buffer.js:184)
at Array.forEach ()
at Object.eval (webpack-internal:///./node_modules/mongoose/lib/types/buffer.js:183)
at eval (webpack-internal:///./node_modules/mongoose/lib/types/buffer.js:306)
at Object../node_modules/mongoose/lib/types/buffer.js (app.bundle.js:2554)
at webpack_require (app.bundle.js:679)
at fn (app.bundle.js:89)
at Object.eval (webpack-internal:///./node_modules/mongoose/lib/schema/buffer.js:10)
at eval (webpack-internal:///./node_modules/mongoose/lib/schema/buffer.js:225)
at Object../node_modules/mongoose/lib/schema/buffer.js (app.bundle.js:2386)
at webpack_require (app.bundle.js:679)
at fn (app.bundle.js:89)
at eval (webpack-internal:///./node_modules/mongoose/lib/schema/array.js:19)
at Object../node_modules/mongoose/lib/schema/array.js (app.bundle.js:2370)
at webpack_require (app.bundle.js:679)
at fn (app.bundle.js:89)
Please mention your node.js, mongoose and MongoDB version.
Node.js 8.12
mongoose 5.3.5
MongoDB 4.0.3
The text was updated successfully, but these errors were encountered: