[英]Nodejs Azure Deployment Failure: ENOENT: no such file or directory, stat '/home/site/wwwroot/node_modules/.bin/semver'
[英]How to fix "Error: /home/site/wwwroot/node_modules/canvas/build/Release/canvas.node: invalid ELF header" on NodeJs Azure Functions in Linux?
我正在嘗試在 NodeJs 中部署 AzureFunctions,但它不適用於 Azure。 我的應用是在 Linux 上運行的 v3 函數。
部署完成后,我收到此 500 錯誤:
錯誤:/home/site/wwwroot/node_modules/canvas/build/Release/canvas.node:無效 ELF header
它僅在我執行此導入時發生:
import ChartDataLabels from 'chartjs-plugin-datalabels';
const canvasRenderService = new CanvasRenderService(width, height, chartCallback);
const chartCallback = (ChartJS) => {
ChartJS.register(require('chartjs-plugin-datalabels'))
};
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const { document } = (new JSDOM(`...`)).window;
有人會幫我嗎?
它(僅)在我的機器上工作:(
編輯:當我通過 Linux 子系統進行部署時,它可以工作。 我希望這會對某人有所幫助。
Azure Node_modules
在部署到 azure 時將不包括 Node_modules。 因為Node_modules
目錄包含非常大的文件。 You can include your package.json
in you function directory and run npm install
as you normally would with Node.js projects using Kudu (https://<function_app_name>.scm.azurewebsites.net )
or the Console in the Azure portal.
檢查依賴管理以獲取更多信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.