Stack Exchange
Connection between Azure MySql + Sequelize
I have a problem to configure the connection beetween Azure Mysql and Node + Sequelize. Could be the node version the problem? This is the error that I receive during the deploy:
Error:
remote: npm ERR! Error: ENOENT, chmod 'D:\home\site\wwwroot\node_modules\sequelize\node_modules\moment\locale\ar-ly.js'
remote: npm ERR! If you need help, you may report this *entire* log,
remote: npm ERR! including the npm and node versions, at:
remote: npm ERR!     <http://github.com/npm/npm/issues>
remote: 
remote: npm ERR! System Windows_NT 6.2.9200
remote: npm ERR! command "D:\\Program Files (x86)\\nodejs\\0.10.28\\node.exe" "D:\\Program Files (x86)\\npm\\1.4.9\\node_modules\\npm\\bin\\npm-cli.js" "install" "--production"
remote: npm ERR! cwd D:\home\site\wwwroot
remote: npm ERR! node -v v0.10.28
remote: npm ERR! npm -v 1.4.9
remote: npm ERR! path D:\home\site\wwwroot\node_modules\sequelize\node_modules\moment\locale\ar-ly.js
remote: npm ERR! fstream_path D:\home\site\wwwroot\node_modules\sequelize\node_modules\moment\locale\ar-ly.js
remote: npm ERR! fstream_type File
remote: npm ERR! fstream_class FileWriter
remote: npm ERR! fstream_finish_call chmod
remote: npm ERR! code ENOENT
remote: npm ERR! errno 34
remote: npm ERR! fstream_stack D:\Program Files (x86)\npm\1.4.9\node_modules\npm\node_modules\fstream\lib\writer.js:305:19
remote: npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
remote: npm ERR! Error: EPERM, lstat 'D:\home\site\wwwroot\node_modules\sequelize\node_modules\lodash\_createOver.js'
remote: npm ERR!  { [Error: EPERM, lstat 'D:\home\site\wwwroot\node_modules\sequelize\node_modules\lodash\_createOver.js']
remote: npm ERR!   errno: 50,
remote: npm ERR!   code: 'EPERM',
remote: npm ERR!   path: 'D:\\home\\site\\wwwroot\\node_modules\\sequelize\\node_modules\\lodash\\_createOver.js',
remote: npm ERR!   fstream_type: 'File',
remote: npm ERR!   fstream_path: 'D:\\home\\site\\wwwroot\\node_modules\\sequelize\\node_modules\\lodash\\_createOver.js',
remote: npm ERR!   fstream_class: 'FileWriter',
remote: npm ERR!   fstream_stack: 
remote: npm ERR!    [ 'D:\\Program Files (x86)\\npm\\1.4.9\\node_modules\\npm\\node_modules\\fstream\\lib\\writer.js:284:26',
remote: npm ERR!      'Object.oncomplete (fs.js:107:15)' ] }
remote: npm ERR! 
remote: npm ERR! Please try running this command again as root/Administrator.
remote: 
remote: npm ERR! System Windows_NT 6.2.9200
remote: npm ERR! command "D:\\Program Files (x86)\\nodejs\\0.10.28\\node.exe" "D:\\Program Files (x86)\\npm\\1.4.9\\node_modules\\npm\\bin\\npm-cli.js" "install" "--production"
remote: npm ERR! cwd D:\home\site\wwwroot
remote: npm ERR! node -v v0.10.28
remote: npm ERR! npm -v 1.4.9
remote: npm ERR! path D:\home\site\wwwroot\node_modules\sequelize\node_modules\lodash\_createOver.js
remote: npm ERR! fstream_path D:\home\site\wwwroot\node_modules\sequelize\node_modules\lodash\_createOver.js
remote: npm ERR! fstream_type File
remote: npm ERR! fstream_class FileWriter
remote: npm ERR! code EPERM
remote: npm ERR! errno 50
remote: npm ERR! stack Error: EPERM, lstat 'D:\home\site\wwwroot\node_modules\sequelize\node_modules\lodash\_createOver.js'
remote: Failed exitCode=34, command="D:\Program Files (x86)\nodejs\0.10.28\node.exe" "D:\Program Files (x86)\npm\1.4.9\node_modules\npm\bin\npm-cli.js" install --production
remote: npm ERR! fstream_stack D:\Program Files (x86)\npm\1.4.9\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
remote: An error has occurred during web site deployment.
remote: npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
remote: npm ERR! error rolling back Error: EPERM, unlink 'D:\home\site\wwwroot\node_modules\sequelize\node_modules\moment-timezone\builds\moment-timezone-with-data-2012-2022.min.js'
remote: npm ERR! error rolling back  sequelize@3.30.4 { [Error: EPERM, unlink 'D:\home\site\wwwroot\node_modules\sequelize\node_modules\moment-timezone\builds\moment-timezone-with-data-2012-2022.min.js']
remote: npm ERR! error rolling back   errno: 50,
remote: npm ERR! error rolling back   code: 'EPERM',
remote: npm ERR! error rolling back   path: 'D:\\home\\site\\wwwroot\\node_modules\\sequelize\\node_modules\\moment-timezone\\builds\\moment-timezone-with-data-2012-2022.min.js' }

This is the code regarding the connection:
var sequelize = new Sequelize('db-name', 'user', 'password', {
  host: 'dbname.database.windows.net',
  dialect: 'mssql',
  pool: {
    max: 5,
    min: 0,
    idle: 10000
  },
  dialectOptions: {
    encrypt: true
  }
});


I'm facing the same problem with this configuration (Web App Service + NodeJS + Sequelize + MySQL). It looks like the problem is the node version on the windows machine.
