NodeJS Azure Sequelize SQL Server - Error: Please install tedious package manually

NodeJS Azure Sequelize SQL Server - Error: Please install tedious package manually

所以我一直在 Windows 机器上本地开发 NodeJs 应用程序。我在 Azure 云中打开了一个简单的 SQL 服务器实例。

以这种方式进行测试时(本地主机上的节点,Azure 云中的 SQL 服务器)一切正常 - 一切正常。

一旦将 nodejs rest api 部署到 Azure(请原谅我的法语),一切都乱套了:

Error: Please install tedious package manually
    at ConnectionManager._loadDialectModule (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:81:15)
    at new ConnectionManager (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\mssql\connection-manager.js:17:21)
    at new MssqlDialect (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\mssql\index.js:14:30)
    at new Sequelize (D:\home\site\wwwroot\node_modules\sequelize\lib\sequelize.js:324:20)
    at Object.<anonymous> (D:\home\site\wwwroot\util\database.js:3:19)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (D:\home\site\wwwroot\server.js:6:19)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (D:\Program Files (x86)\iisnode\interceptor.js:459:1)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
Application has thrown an uncaught exception and is terminated:
Error: Please install tedious package manually
    at ConnectionManager._loadDialectModule (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:81:15)
    at new ConnectionManager (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\mssql\connection-manager.js:17:21)
    at new MssqlDialect (D:\home\site\wwwroot\node_modules\sequelize\lib\dialects\mssql\index.js:14:30)
    at new Sequelize (D:\home\site\wwwroot\node_modules\sequelize\lib\sequelize.js:324:20)
    at Object.<anonymous> (D:\home\site\wwwroot\util\database.js:3:19)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (D:\home\site\wwwroot\server.js:6:19)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (D:\Program Files (x86)\iisnode\interceptor.js:459:1)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)

这是我的 package.json 文件的快照:

"devDependencies": {
    "dotenv": "^8.2.0",
    "nodemon": "^2.0.3"
  },
  "dependencies": {
    "axios": "^0.19.2",
    "azure-storage": "^2.10.3",
    "bcryptjs": "^2.4.3",
    "body-parser": "^1.19.0",
    "express": "^4.17.1",
    "formdata-node": "^2.1.1",
    "into-stream": "^5.1.1",
    "jsonwebtoken": "^8.5.1",
    "mssql": "^6.1.0",
    "multer": "^1.4.2",
    "nodemailer": "^6.4.5",
    "sequelize": "^5.21.7",
    "tedious": "^8.0.1",
    "uuid-token-generator": "^1.0.0"
  }

我从 Azure 返回的错误页面上的错误是 thrown/shown:

HTTP Error 500.1002 - Internal Server Error

我不确定我做错了什么。我需要一些帮助。

部署网络应用程序时,应用程序环境因素很重要。 Azure作为程序的托管服务,肯定有一些与本地不同的环境。

所以我建议访问网站https://your-app.scm.azurewebsites.net/DebugConsole进入kudu进入site->wwwroot文件夹删除服务器上的node_modules文件夹。将本地项目中的node_modules压缩成zip格式,然后直接拖放到kudu中。然后进行下一个测试。

你也可以在命令行中运行 npm install tedious,但我失败了,不知道为什么。但我仍然认为这是解决问题的好方法。更多详情,您可以访问url.