Skip to content
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

not work with mysql #423

Closed
gassyou opened this issue Dec 25, 2019 · 2 comments
Closed

not work with mysql #423

gassyou opened this issue Dec 25, 2019 · 2 comments

Comments

@gassyou
Copy link

gassyou commented Dec 25, 2019

hi

i want add connect mysql feature base on your code.
it work fine when i run npm rum start.

but when i want build a windows app using npm run electron:windows.
and following problem is happend.

Error: Received packet in the wrong sequence.
    at u._parsePacket (file:///C:/Users/Mars/AppData/Local/Temp/1VTEfjB4MFi1QQbqOIxHf4cp9sc/resources/app.asar/dist/main.434c406….js:1:281511)
    at u.KBiZ.u._parsePacket (file:///C:/Users/Mars/AppData/Local/Temp/1VTEfjB4MFi1QQbqOIxHf4cp9sc/resources/app.asar/dist/main.434c406….js:1:162890)
    at u.KBiZ.u.write (file:///C:/Users/Mars/AppData/Local/Temp/1VTEfjB4MFi1QQbqOIxHf4cp9sc/resources/app.asar/dist/main.434c406….js:1:157155)

i add following content in package.json file

 "dependencies": {
    "mysql": "2.17.1"
  }

and do connection in HomeComponent

 connect() {
    const connection = mysql.createConnection({
      host     : 'XXXX',
      port     : '3306',
      user     : 'XXXX',
      password : 'XXXX',
      database : 'demo',
    });

    connection.connect(
        err => {
            if (err) {
              console.log(err);
              console.log('Connection error!');
            }
            else {
              console.log('Connected!');
            }
        }
    );
}

Thanks a lot.

@maximegris
Copy link
Owner

maximegris commented Dec 25, 2019

It seems related to mysqljs/mysql#1548 and file optimisation (uglify) when building in production.

Try setting buildOptimizer : false and/or optimization: false in angular.json production profile (line 71 and 79). It may works. Otherwise you should overide the webpack configuration to fix the default mangling behaviour.

@gassyou
Copy link
Author

gassyou commented Dec 26, 2019

Yes, It work fine.
Thank you very much.

@gassyou gassyou closed this as completed Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants