简体   繁体   中英

Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException: Cannot find module 'dotenv'

Azure Static Web App (SWA) with integrated API whose index.js has

require('dotenv').config({ path: './environment/misc.env'});

Local-run Azure Static Web Apps emulator perfect. Merged into GitHub master branch triggers Azure CI/CD deploy into Azure, test got

Stack: Error: Cannot find module 'dotenv'

dotenv is in SWA's root package.json

"dependencies":
{
  ...
  "dotenv": "^16.0.0"
}

GitHub project, Actions all jobs are good

SWA environment settings Front-end

  • Local, \src\app\environments\environment.ts (or your own customized location)
  • PROD AZ cloud, .yml file, add env

Backend

  • Local, api/local.settings.json
  • PROD AZ, Portal, Configuration

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM