在具有节点14运行时的Azure App服务上找不到pm2 [英] pm2 not found on Azure App service with Node 14 runtime

查看:64
本文介绍了在具有节点14运行时的Azure App服务上找不到pm2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要实现的目标是使用Linux OS将Angular 9应用程序部署到Azure App服务(Windows不适合我,因为Linux便宜)我使用Node 14运行时创建了Linux Web应用程序.部署应用程序后,我会看到Azure默认网页.我试图解决它,因为它被描述为

本地文件.

天蓝色的wwwroot中的文件.

上一个

经过测试,我认为这应该是一个错误.如果必须使用节点14LTS,建议您在门户网站上获得支持票以寻求帮助.

重复出现的问题:

  1. 创建一个Linux节点14LTS Web应用程序.

  2. 创建ng9项目,使用vscode部署并成功.打开网站并向我们显示默认页面.

  3. 使用 pm2 serve/home/site/wwwroot --no-daemon --spa pm2 serve/home/site/wwwroot/dist/<添加启动cmd您的项目名称>--no-daemon --spa ,并且全部失败.

尝试解决:

  1. 我在 Stack设置中更改了主要版本,项目正常运行.

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:

  1. I added this

    pm2 serve /home/site/wwwroot --no-daemon --spa

to AppService->Configuration->General Settings->Startup Command

  1. Saved configuration and restarted App Service But got pm2 not found error.

  2. Connected to web app using ssh and have run

    npm install pm2 -g

  3. 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:

  1. Create a linux node 14LTS web app.

  2. Create ng9 project, use vscode deploy and success. Open website and show us default page.

  3. Add startup cmd with pm2 serve /home/site/wwwroot --no-daemon --spa or pm2 serve /home/site/wwwroot/dist/<your project name> --no-daemon --spa , and all failed.

Try to solve:

  1. I change Major version in Stack settings, and the project runs normally.

这篇关于在具有节点14运行时的Azure App服务上找不到pm2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆