Azure MySql + Sequelize之间的连接

时间:2017-06-29 09:46:30

标签: mysql node.js azure azure-sql-database sequelize.js

我在Azure Mysql和Node + Sequelize之间配置连接时遇到问题。可能是节点版本的问题?这是我在部署期间收到的错误:

错误:

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' }

这是关于连接的代码:

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
  }
});

1 个答案:

答案 0 :(得分:1)

我遇到了与此配置相同的问题(Web App Service + NodeJS + Sequelize + MySQL)。看起来问题是Windows机器上的节点版本。