728x90
728x90
Azure App Services 프로젝트 배포 후, Cannot find module 오류 해결법
들어가며
- Azure App Services를 이용하여 프로젝트 배포 후, @Cannot find module@ 관련 오류가 발생할 경우 빠르게 해결하는 방법을 정리해본다.

방법
방법 ① : Kudu Console 이용하기 (수동 설치)
- 애저 포털에서 자신이 배포한 App Service 리소스 페이지에 들어간다.
- 왼쪽 메뉴에서 [고급 도구(Advanced Tools)] → [이동(Go)] 을 클릭하여 Kudu 페이지에 접속한다.

- Kudu 페이지 상단의 @[SSH]@ 탭을 클릭한다.

- 터미널에서 아래의 명령을 순서대로 실행해준다.
$ cd site/wwwroot
$ npm install <MissingModuleName> --production

Azure App Services를 이용하여 배포 후, 프로젝트는 site/wwwroot 경로에 위치하게 된다.
- 배포한 App Service 리소스를 다시 시작해준다.

Kudu는 Azure App Services 의 배포 엔진으로, 배포와 관련된 모든 백엔드 작업을 제어할 수 있는 포털을 제공한다.
방법 ② : SCM_DO_BUILD_DURING_DEPLOYMENT을 true로 설정하기
- Azure Cloud Shell 또는 Azure 패키지가 설치된 터미널에서 아래 명령을 실행한다.
- @SCM_DO_BUILD_DURING_DEPLOYMENT@ 변수를 @true@로 설정할 경우, 배포 시 서버가 직접 @npm install@ 및 @npm run build@를 수행한다.
$ az webapp config appsettings set \
--name <YourAppName> \
--resource-group <YourResourceGroup> \
--settings SCM_DO_BUILD_DURING_DEPLOYMENT=true
- 설정 후, 터미널에 아래 명령을 실행하여 제대로 설정이 되었는지 확인한다.
$ az webapp config appsettings list \
--name <YourAppName> \
--resource-group <YourResourceGroup>
{
"name": "SCM_DO_BUILD_DURING_DEPLOYMENT",
"value": "true" // ✅
}
- 다시 배포 작업을 수행한다.
참고 사이트
Home
Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure. - projectkudu/kudu
github.com
Configure an App Service App - Azure App Service
Learn how to configure common settings for an Azure App Service app. You can use the Azure portal, Azure CLI, or Azure PowerShell.
learn.microsoft.com
728x90
728x90
'DevOps > Azure' 카테고리의 다른 글
| [Azure] Azure Cosmos DB for MongoDB (RU) 연동하기 (1) | 2025.07.11 |
|---|---|
| [Azure] App Services에 Next.js 15 배포하기 (VS Code, LocalGit) (3) | 2025.06.05 |
| [Azure] Visual Studio 서비스를 이용하여 CRUD 애플리케이션 제작하기 (0) | 2023.06.07 |
| [Azure] Azure Machine Learning Service 사용해보기 : Notebooks (0) | 2023.06.01 |
| [Azure] Azure Machine Learning Service 사용해보기 : Automated ML (0) | 2023.05.31 |
| [Azure] Azure Machine Learning Service 사용해보기 : Designer (0) | 2023.05.31 |
| [Azure] 쿠버네티스(Kubernetes) 실습하기 : AKS(Azure Kubernetes Service) 실습 (0) | 2023.05.30 |
| [Azure] 쿠버네티스(Kubernetes) 실습하기 : 간단한 실습 해보기 (0) | 2023.05.29 |