Today, when I wrote node.js to operate the database, I encountered a typeerror: connection.connect is not a function when setting up the database connection. The following is the bug prompt, as shown in the figure
when I found this error, I immediately went to connection.connect, but I didn’t find anything wrong,
For this reason, I made a special effort to find the previous code and compare it. The following is the thinking at that time
later, I asked my friend to check the custom module
PS: after staring at it for more than ten minutes, I didn’t find the error. At this moment, I felt like a mentally retarded person
later, I had to check one by one, I found that my mistake was to write the return value of the function as an object….. Verification complete….. Retarded stone hammer…..
Change it to the following way
rerun
Read More:
- JS error – typeerror: XXX is not a function
- TypeError: this.getOptions is not a function at Object.lessLoader
- [How to Solve]Warning: connect.static is not a function
- [Solved] jQuery Error: Uncaught TypeError: this.attr is not a function
- TypeError: this.getOptions is not a function
- Using webpack to report typeerror: this.getresolve is not a function
- [Solved] Error handling response: TypeError: self.processResponse is not a function
- [react+antd] Table Error: Unhandled Rejection (TypeError): data.slice is not a function
- Common error: uncaught typeerror: document.getElementsByClassName (…).addEventListener is not a function
- Syntax error: typeerror: this.getoptions is not a function an error is reported when the. SCSS file is imported globally
- Webpack error module build failed: typeerror: fileSystem.statSync is not a function
- Typeerror in gitbook init: cb.apply is not a function solution
- Typeerror occurred during gitbook installation: cb.apply is not a function
- Uncaught (in promise) TypeError: Object(…) is not a function
- Python error prompt: typeerror: ‘builtin’_ function_ or_ method‘ object is not subscriptable
- Vue Error in v-on handler: “TypeError: path.indexOf is not a function“
- Vue error in mounted hook: “typeerror: object (…) is not a function“
- Authentication error occurred on remote connection, the required function is not supported
- Vue — report error with less module build failed: typeerror: loaderContext.getResolve is not a function
- PHP connection PostgreSQL error call to undefined function PG_ connect()