You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Functions项目使用npm start启动失败但func start可正常运行的问题求助

Azure Functions项目使用npm start启动失败但func start可正常运行的问题求助

大家好,我最近在Azure Functions项目里碰到一个奇怪的问题,想请各位帮忙排查下:

我项目里的package.json关键配置部分如下:

"scripts": {
  "build": "tsc",
  "watch": "tsc -w",
  "clean": "rimraf dist",
  "prestart": "npm run clean && npm run build",
  "start": "func start",
  "test": "jest --coverage"
},
"dependencies": {
  "@azure/data-tables": "^13.3.0",
  "@azure/event-hubs": "^5.12.2",
  "@azure/functions": "^4.0.0",
  "@azure/openai": "^2.0.0",
}

host.json的内容是这样的:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[4.*, 5.0.0)"
  }
}

当我运行npm start命令时,项目启动失败,报错信息如下:

[2026-03-03T19:32:34.843Z] A host error has occurred during startup operation '9c57a68b-77c9-4f1b-8877-01ac04444ab0'.
[2026-03-03T19:32:34.846Z] Microsoft.Azure.WebJobs.Extensions.EventHubs: Could not load file or assembly 'System.Memory.Data, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
[2026-03-03T19:32:34.846Z] .
Value cannot be null. (Parameter 'provider')
[2026-03-03T19:32:34.882Z] Host startup operation has been canceled

但如果我直接运行func start命令,项目就能正常启动,完全没有问题。

有没有大佬知道这是哪里出问题了?麻烦给点思路,谢谢啦!

备注:内容来源于stack exchange,提问作者jmiguel77

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.13 18:13:47