在具有 Node 14 运行时的 Azure 应用服务上找不到 pm2 [英] pm2 not found on Azure App service with Node 14 runtime
问题描述
我想要实现的是使用 Linux 操作系统将 Angular 9 应用程序部署到 Azure 应用程序服务(Windows 不适合我,因为 Linux 更便宜)我使用 Node 14 运行时创建了 Linux Web 应用程序.部署应用程序后,我看到 Azure 默认网页.我试图解决这个问题,因为它描述了
本地文件.
Azure 上 wwwroot 中的文件.
上一页
经过测试,我认为这应该是一个错误.如果一定要使用node 14LTS,建议在portal上提出支持票寻求帮助.
反复出现的问题:
创建一个 linux 节点 14LTS 网络应用程序.
创建ng9项目,使用vscode部署成功.打开网站并向我们显示默认页面.
使用
pm2 serve/home/site/wwwroot --no-daemon --spa
或pm2 serve/home/site/wwwroot/dist/添加启动 cmd您的项目名称>--no-daemon --spa
,都失败了.
尝试解决:
- 我在
堆栈设置
中更改主要版本
,项目运行正常.
What I am trying to achieve is to deploy Angular 9 app to Azure App service with Linux OS (Windows does not suit me because Linux is cheaper) I created Linux web app with Node 14 runtime. After I deployed my app I see Azure default web page. I tried to resolve that as it is described here
Steps I did on Linux web app with Node 14 runtime:
I added this
pm2 serve /home/site/wwwroot --no-daemon --spa
to AppService->Configuration->General Settings->Startup Command
Saved configuration and restarted App Service But got pm2 not found error.
Connected to web app using ssh and have run
npm install pm2 -g
Restarted App Service but still getting pm2 not found.
The question is how to host Angular 9 on Linux app service with Node 14? Should I fix that pm2 not found or I can use some other approach (but still with Linux OS) to solve that?
Newest
If you are not concerned about the release method, it is recommended that you execute ng build locally, and then drag and drop all the files in the <your project name>
folder directly to wwwroot, or use FTP to upload. Then modify startup cmd with npx serve -s
, it also can work.
Files in local.
Files in wwwroot on azure.
Previous
After testing, I think this should be a bug. If you must use node 14LTS, I suggest you raise a support ticket on portal for help.
Recurring problem:
Create a linux node 14LTS web app.
Create ng9 project, use vscode deploy and success. Open website and show us default page.
Add startup cmd with
pm2 serve /home/site/wwwroot --no-daemon --spa
orpm2 serve /home/site/wwwroot/dist/<your project name> --no-daemon --spa
, and all failed.
Try to solve:
- I change
Major version
inStack settings
, and the project runs normally.
这篇关于在具有 Node 14 运行时的 Azure 应用服务上找不到 pm2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!