我嘗試使用nodejs創建一個webjob,腳本使用各種節點模塊,但是當作業運行時,它似乎未預先安裝程序包。Azure Web App WebJob未安裝節點程序包
我上傳的zip文件包含一個package.json,其中包含所有的依賴關係和一個server.js,zip腳本被執行,但是根據下面的日誌,它找不到要運行的模塊。
我在日誌中獲得以下輸出。
[07/28/2015 07:36:14 > 5fabb6: SYS INFO] Status changed to Initializing
[07/28/2015 07:36:14 > 5fabb6: SYS INFO] Run script 'server.js' with script host - 'NodeScriptHost'
[07/28/2015 07:36:14 > 5fabb6: SYS INFO] Status changed to Running
[07/28/2015 07:36:15 > 5fabb6: ERR ]
[07/28/2015 07:36:15 > 5fabb6: ERR ] module.js:340
[07/28/2015 07:36:15 > 5fabb6: ERR ] throw err;
[07/28/2015 07:36:15 > 5fabb6: ERR ] ^
[07/28/2015 07:36:15 > 5fabb6: ERR ] Error: Cannot find module 'sendgrid'
[07/28/2015 07:36:15 > 5fabb6: ERR ] at Function.Module._resolveFilename (module.js:338:15)
[07/28/2015 07:36:15 > 5fabb6: ERR ] at Function.Module._load (module.js:280:25)
[07/28/2015 07:36:15 > 5fabb6: ERR ] at Module.require (module.js:364:17)
[07/28/2015 07:36:15 > 5fabb6: ERR ] at require (module.js:380:17)
[07/28/2015 07:36:15 > 5fabb6: ERR ] at Object.<anonymous> (D:\home\site\wwwroot\App_Data\jobs\triggered\TestWebJob\dist\services\email.service.js:4:16)
[07/28/2015 07:36:15 > 5fabb6: ERR ] at Module._compile (module.js:456:26)
[07/28/2015 07:36:15 > 5fabb6: ERR ] at Object.Module._extensions..js (module.js:474:10)
[07/28/2015 07:36:15 > 5fabb6: ERR ] at Module.load (module.js:356:32)
[07/28/2015 07:36:15 > 5fabb6: ERR ] at Function.Module._load (module.js:312:12)
[07/28/2015 07:36:15 > 5fabb6: ERR ] at Module.require (module.js:364:17)
[07/28/2015 07:36:15 > 5fabb6: SYS INFO] Status changed to Failed
[07/28/2015 07:36:15 > 5fabb6: SYS ERR ] Job failed due to exit code 8
我要補充我也試過,包括在zip文件中的node_modules但這甚至未能上傳,拉鍊低於100MB大小限制。我相信這可能是由於新的文件。 – JohnC