如何在React Native应用中使用Node启动Express服务器

huangapple go评论77阅读模式
英文:

How to start express server with node in react native app

问题

我尝试使用以下命令启动包含我的MySQL连接详细信息的服务器文件:sudo node server.js,但是我收到了以下错误信息:

DEPRECATED use https://github.com/pillarjs/path-to-regexp
start
{ Error: ER_NOT_SUPPORTED_AUTH_MODE: 客户端不支持服务器请求的身份验证协议;考虑升级MySQL客户端
at Handshake.Sequence._packetToError (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
at Handshake.ErrorPacket (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
at Protocol._parsePacket (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/Parser.js:43:10)
at Protocol.write (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket.<anonymous> (/home/pandat/Desktop/myapp/node_modules/mysql/lib/Connection.js:91:28)
at Socket.<anonymous> (/home/pandat/Desktop/myapp/node_modules/mysql/lib/Connection.js:525:10)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
--------------------
at Protocol._enqueue (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/Protocol.js:144:48)
at Protocol.handshake (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/Protocol.js:51:23)
at Connection.connect (/home/pandat/Desktop/myapp/node_modules/mysql/lib/Connection.js:119:18)
at Object.<anonymous> (/home/pandat/Desktop/myapp/server.js:19:5)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
code: 'ER_NOT_SUPPORTED_AUTH_MODE',
errno: 1251,
sqlMessage: '客户端不支持服务器请求的身份验证协议;考虑升级MySQL客户端',
sqlState: '08004',
fatal: true }

英文:

I tried to start my server file that contains my MySQL connection details with command sudo node server.js but I got this error:

pandat@pandat:~/Desktop/myapp$ sudo node server.js
[sudo] password for pandat: 
DEPRECATED use https://github.com/pillarjs/path-to-regexp
start
{ Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
    at Handshake.Sequence._packetToError (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
    at Handshake.ErrorPacket (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
    at Protocol._parsePacket (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/Protocol.js:291:23)
    at Parser._parsePacket (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/Parser.js:433:10)
    at Parser.write (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/Parser.js:43:10)
    at Protocol.write (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/Protocol.js:38:16)
    at Socket.&lt;anonymous&gt; (/home/pandat/Desktop/myapp/node_modules/mysql/lib/Connection.js:91:28)
    at Socket.&lt;anonymous&gt; (/home/pandat/Desktop/myapp/node_modules/mysql/lib/Connection.js:525:10)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    --------------------
    at Protocol._enqueue (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/Protocol.js:144:48)
    at Protocol.handshake (/home/pandat/Desktop/myapp/node_modules/mysql/lib/protocol/Protocol.js:51:23)
    at Connection.connect (/home/pandat/Desktop/myapp/node_modules/mysql/lib/Connection.js:119:18)
    at Object.&lt;anonymous&gt; (/home/pandat/Desktop/myapp/server.js:19:5)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
  code: &#39;ER_NOT_SUPPORTED_AUTH_MODE&#39;,
  errno: 1251,
  sqlMessage: &#39;Client does not support authentication protocol requested by server; consider upgrading MySQL client&#39;,
  sqlState: &#39;08004&#39;,
  fatal: true }

答案1

得分: -1

使用以下命令安装:

npm install -g express-generator
英文:

use

npm install -g express-generator

huangapple
  • 本文由 发表于 2020年1月4日 00:40:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/59582166.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定