-
-
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
Strange SyntaxError in MongoDB after upgrading Mongoose to v7 #13204
Comments
Can you please double check your Node.js version using If you are indeed on Node.js 18, can you please provide your |
Same issue here, node.js v18 |
@ronenteva your comment is not very helpful. Please provide more detailed instructions on how to repro this issue. |
@vkarpov15 I'm sorry, I still couldn't find exactly how to reproduce the issue, but I'm pretty sure it has something to do with esm installed. |
We'll try out with esm. But just a thought - why do you need an esm bundler if Node.js supports esm natively? |
I use it for older projects, so I can have both |
i can confirm that the issue is appeared when using
|
Confirmed this is a known issue in esm: standard-things/esm#918 (comment) . Also standard-things/esm#909. TLDR; esm hasn't been maintained in some time, doesn't work with more recent additions to the JavaScript language spec. You would need to use a fork of esm, like esm-wallaby. |
Prerequisites
Mongoose version
7.0.2
Node.js version
18.13.0
MongoDB server version
5.1.0
Typescript version (if applicable)
4.8.4
Description
Issue after upgrading to Mongoose V7. In the MongoDB library
The toke is
?.
which makes no sense since?.
operator appears to be normal and has worked in much younger versions of node.Multiple reports appear on stack overflow, with the only recommendation being "downgrade to v6":
https://stackoverflow.com/questions/75681631/why-node-js-gives-this-error-from-the-npm-modules
https://stackoverflow.com/questions/75675925/syntax-and-database-connection-error-in-node-js
Steps to Reproduce
Upgraded from v5 to v7 (any version 7). I have no MongoDB installed through package.json (only installed courtesy of Mongoose) After building in TS, running the server using nodemon, I get the following error:
Stack trace:
I'm working in Ubuntu 22.04.2
Downgrading to v6 doesn't have this problem.
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: