You have tried to call .the(), .catch()
**Question.**
1. What is the reason for the problem?
2. How to fix the problem?
I have a project, I want to launch it.
The project is located in the folder `e:\Test\Pro01\`.
**I've done it:**
- I opened the Windows console;
- I entered the command `cd e:\Test\Pro01\`;
- I entered the `node app.js`;
- result: I get an error message;
**I use:**
- Windows-10 x64;
- VSCode;
- Visual Studio 2022 Community(NodeJS installed);
- Node.js (c:\Program Files\nodejs\node.exe);
- Wampserver64;
- MySql;
----------
Attach
------
**Error message:**
*e:\Test\Pro01>node app.js
Start at http://localhost:3000
You have tried to call .then(), .catch(), or invoked await on the result of query that is not a promise,
which is a programming error.
Try calling con.promise().query(), or require('mysql2/promise') instead of 'mysql2'
for a promise-compatible version of the query interface. T
o learn how to use async/await
or Promises check out documentation
at https://www.npmjs.com/package/mysql2#using-promise-wrapper,
or the mysql2 documentation at https://github.com/sidorares/node-mysql2/tree/master/documentation/Promise-Wrapper.md
e:\Test\Pro01\node_modules\mysql2\lib\commands\query.js:41
throw new Error(err);
^
Error: You have tried to call .then(), .catch(), or invoked await on the result of query that is not a promise, which is a programming error. Try calling con.promise().query(), or require('mysql2/promise') instead of 'mysql2' for a promise-compatible version of the query interface. To learn how to use async/await or Promises check out documentation at https://www.npmjs.com/package/mysql2#using-promise-wrapper, or the mysql2 documentation at https://github.com/sidorares/node-mysql2/tree/master/documentation/Promise-Wrapper.md
at Query.then (e:\Test\Pro01\node_modules\mysql2\lib\commands\query.js:41:11)
at MySQLStore.query (e:\Test\Pro01\node_modules\express-mysql-session\index.js:392:12)
at MySQLStore.<anonymous> (e:\Test\Pro01\node_modules\express-mysql-session\index.js:110:9)
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
Node.js v18.7.0
e:\Test\Pro01>*
**Question.**
1. What is the reason for the problem?
2. How to fix the problem?
I have a project, I want to launch it.
The project is located in the folder `e:\Test\Pro01\`.
**I've done it:**
- I opened the Windows console;
- I entered the command `cd e:\Test\Pro01\`;
- I entered the `node app.js`;
- result: I get an error message;
**I use:**
- Windows-10 x64;
- VSCode;
- Visual Studio 2022 Community(NodeJS installed);
- Node.js (c:\Program Files\nodejs\node.exe);
- Wampserver64;
- MySql;
----------
Attach
------
**Error message:**
*e:\Test\Pro01>node app.js
Start at http://localhost:3000
You have tried to call .then(), .catch(), or invoked await on the result of query that is not a promise,
which is a programming error.
Try calling con.promise().query(), or require('mysql2/promise') instead of 'mysql2'
for a promise-compatible version of the query interface. T
o learn how to use async/await
or Promises check out documentation
at https://www.npmjs.com/package/mysql2#using-promise-wrapper,
or the mysql2 documentation at https://github.com/sidorares/node-mysql2/tree/master/documentation/Promise-Wrapper.md
e:\Test\Pro01\node_modules\mysql2\lib\commands\query.js:41
throw new Error(err);
^
Error: You have tried to call .then(), .catch(), or invoked await on the result of query that is not a promise, which is a programming error. Try calling con.promise().query(), or require('mysql2/promise') instead of 'mysql2' for a promise-compatible version of the query interface. To learn how to use async/await or Promises check out documentation at https://www.npmjs.com/package/mysql2#using-promise-wrapper, or the mysql2 documentation at https://github.com/sidorares/node-mysql2/tree/master/documentation/Promise-Wrapper.md
at Query.then (e:\Test\Pro01\node_modules\mysql2\lib\commands\query.js:41:11)
at MySQLStore.query (e:\Test\Pro01\node_modules\express-mysql-session\index.js:392:12)
at MySQLStore.<anonymous> (e:\Test\Pro01\node_modules\express-mysql-session\index.js:110:9)
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
Node.js v18.7.0
e:\Test\Pro01>*