I am trying to deploy an Angular(10) WebApp
to Azure with CI/CD using the Github Actions but I get an error saying the package.json
cannot be found while running the npm install
command.
This is my yml file
name: Deploy to Azure with Hexa.ru
on:
push:
branches:
- main
- release/*
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: |
npm --prefix D:\home\site\wwwroot\SleepDiary\package.json install
- name: npm build, and deploy
env:
AZURE_SERVICE_PRINCIPAL_ID: ${{ secrets.AZURE_SERVICE_PRINCIPAL_ID }}
AZURE_SERVICE_PRINCIPAL_PASSWORD: ${{ secrets.AZURE_SERVICE_PRINCIPAL_PASSWORD }}
AZURE_SERVICE_PRINCIPAL_TENANT: ${{ secrets.AZURE_SERVICE_PRINCIPAL_TENANT }}
run: |
npm run hexa:login
npm run build -- --prod
npm run hexa:deploy
And the error:
Run npm --prefix D:\home\site\wwwroot\SleepDiary\package.json install
npm --prefix D:\home\site\wwwroot\SleepDiary\package.json install
shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
npm ERR! code ENOLOCAL
npm ERR! Could not install from "" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\npm\cache\_logs\2020-09-28T06_32_50_591Z-debug.log
Error: Process completed with exit code 1.
I also tried without the parameter --prefix
and the error remains (similar)
Run npm install
npm install
shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
npm WARN saveError ENOENT: no such file or directory, open 'D:\a\SleepDiary\SleepDiary\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'D:\a\SleepDiary\SleepDiary\package.json'
npm WARN SleepDiary No description
npm WARN SleepDiary No repository field.
npm WARN SleepDiary No README data
npm WARN SleepDiary No license field.
I've checked the path in the azure console of my appservice and it should be
D:\home\site\wwwroot\SleepDiary
(you can ignore the dist
folder, I created a kudu deployment that works just for testing but I want to achieve the same result with github actions)
Any idea how to make it run?