我正在尝试将命令mysqlx导入到我的React App中。
我尝试了几种不同的方法,但是在控制台中无法识别命令mysqlx。似乎如果不将其导入到应用程序中就无法调用它。我对此很陌生,所以可能很容易。这些都在本地Windows计算机上。
import mysqlx from '@mysql/xdevapi'
在我尝试运行该应用程序之后。请参阅下面的错误。
TypeError: Cannot read property 'toString' of undefined
(anonymous function)
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/node_modules/@mysql/xdevapi/lib/Protocol/Util/systemAttributes.js:101
98 | }
99 |
100 | const clientAttributes = {
> 101 | _pid: process.pid.toString(),
102 | _platform: platformName(),
103 | _os: osName(),
104 | _source_host: sourceHostName(),
View compiled
./node_modules/@mysql/xdevapi/lib/Protocol/Util/systemAttributes.js
http://localhost:3000/static/js/0.chunk.js:44169:30
__webpack_require__
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:785
782 | };
783 |
784 | // Execute the module function
> 785 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
| ^ 786 |
787 | // Flag the module as loaded
788 | module.l = true;
View compiled
fn
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:150
147 | );
148 | hotCurrentParents = [];
149 | }
> 150 | return __webpack_require__(request);
| ^ 151 | };
152 | var ObjectFactory = function ObjectFactory(name) {
153 | return {
View compiled
▼ 2 stack frames were expanded.
(anonymous function)
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/node_modules/@mysql/xdevapi/lib/Protocol/Client.js:68
./node_modules/@mysql/xdevapi/lib/Protocol/Client.js
http://localhost:3000/static/js/0.chunk.js:22283:30
▲ 2 stack frames were expanded.
__webpack_require__
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:785
782 | };
783 |
784 | // Execute the module function
> 785 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
| ^ 786 |
787 | // Flag the module as loaded
788 | module.l = true;
View compiled
fn
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:150
147 | );
148 | hotCurrentParents = [];
149 | }
> 150 | return __webpack_require__(request);
| ^ 151 | };
152 | var ObjectFactory = function ObjectFactory(name) {
153 | return {
View compiled
./node_modules/@mysql/xdevapi/lib/DevAPI/Session.js
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/node_modules/@mysql/xdevapi/lib/DevAPI/Session.js:32
__webpack_require__
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:785
782 | };
783 |
784 | // Execute the module function
> 785 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
| ^ 786 |
787 | // Flag the module as loaded
788 | module.l = true;
View compiled
fn
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:150
147 | );
148 | hotCurrentParents = [];
149 | }
> 150 | return __webpack_require__(request);
| ^ 151 | };
152 | var ObjectFactory = function ObjectFactory(name) {
153 | return {
View compiled
./node_modules/@mysql/xdevapi/lib/DevAPI/ConnectionPool.js
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/node_modules/@mysql/xdevapi/lib/DevAPI/ConnectionPool.js:32
__webpack_require__
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:785
782 | };
783 |
784 | // Execute the module function
> 785 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
| ^ 786 |
787 | // Flag the module as loaded
788 | module.l = true;
View compiled
fn
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:150
147 | );
148 | hotCurrentParents = [];
149 | }
> 150 | return __webpack_require__(request);
| ^ 151 | };
152 | var ObjectFactory = function ObjectFactory(name) {
153 | return {
View compiled
./node_modules/@mysql/xdevapi/lib/DevAPI/Client.js
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/node_modules/@mysql/xdevapi/lib/DevAPI/Client.js:32
__webpack_require__
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:785
782 | };
783 |
784 | // Execute the module function
> 785 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
| ^ 786 |
787 | // Flag the module as loaded
788 | module.l = true;
View compiled
fn
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:150
147 | );
148 | hotCurrentParents = [];
149 | }
> 150 | return __webpack_require__(request);
| ^ 151 | };
152 | var ObjectFactory = function ObjectFactory(name) {
153 | return {
View compiled
./node_modules/@mysql/xdevapi/index.js
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/node_modules/@mysql/xdevapi/index.js:36
__webpack_require__
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:785
782 | };
783 |
784 | // Execute the module function
> 785 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
| ^ 786 |
787 | // Flag the module as loaded
788 | module.l = true;
View compiled
fn
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:150
147 | );
148 | hotCurrentParents = [];
149 | }
> 150 | return __webpack_require__(request);
| ^ 151 | };
152 | var ObjectFactory = function ObjectFactory(name) {
153 | return {
View compiled
Module../src/App.js
http://localhost:3000/static/js/main.chunk.js:91:72
__webpack_require__
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:785
782 | };
783 |
784 | // Execute the module function
> 785 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
| ^ 786 |
787 | // Flag the module as loaded
788 | module.l = true;
View compiled
fn
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:150
147 | );
148 | hotCurrentParents = [];
149 | }
> 150 | return __webpack_require__(request);
| ^ 151 | };
152 | var ObjectFactory = function ObjectFactory(name) {
153 | return {
View compiled
Module../src/index.js
http://localhost:3000/static/js/main.chunk.js:220:62
__webpack_require__
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:785
782 | };
783 |
784 | // Execute the module function
> 785 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
| ^ 786 |
787 | // Flag the module as loaded
788 | module.l = true;
View compiled
fn
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:150
147 | );
148 | hotCurrentParents = [];
149 | }
> 150 | return __webpack_require__(request);
| ^ 151 | };
152 | var ObjectFactory = function ObjectFactory(name) {
153 | return {
View compiled
0
http://localhost:3000/static/js/main.chunk.js:359:18
__webpack_require__
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:785
782 | };
783 |
784 | // Execute the module function
> 785 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
| ^ 786 |
787 | // Flag the module as loaded
788 | module.l = true;
View compiled
checkDeferredModules
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:45
42 | }
43 | if(fulfilled) {
44 | deferredModules.splice(i--, 1);
> 45 | result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
| ^ 46 | }
47 | }
48 |
View compiled
Array.webpackJsonpCallback [as push]
C:/Users/brian/OneDrive/Desktop/nms-appV4/nms-app/webpack/bootstrap:32
29 | deferredModules.push.apply(deferredModules, executeModules || []);
30 |
31 | // run deferred modules when all chunks ready
> 32 | return checkDeferredModules();
| ^ 33 | };
34 | function checkDeferredModules() {
35 | var result;
View compiled
(anonymous function)
http://localhost:3000/static/js/main.chunk.js:1:67
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.
最佳答案
这里没有太多信息,但是根据您的错误:process.pid
未定义。您必须弄清楚为什么未定义。还有类似的问题:
Node console.log(process.pid) prints undefined
关于mysql - 如何将命令mysqlx导入我的React App?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58686582/