Dark Sorrow
Dark Sorrow

Reputation: 1897

Firebase Automated Hosting via Github Error

I have developed a website using Flutter-Web and now I am trying to host it on Firebase.
I have interfaced with git so that every time I commit to master the website will be pushed to Firebase hosting but I am getting the bellow error in Github actions console.

Error

Run npm ci && npm run build
npm ERR! The `npm ci` command can only install with an existing package-lock.json or
npm ERR! npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
npm ERR! later to generate a package-lock.json file, then try again.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-05-26T17_22_27_052Z-debug-0.log
Error: Process completed with exit code 1.

Update (09-06-2022)

Workflow File

# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
'on':
  push:
    branches:
      - master
jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: 'y'
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: '${{ secrets.GITHUB_TOKEN }}'
          firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_DARK_SORROW_WEBSITE }}'
          channelId: live
          projectId: dark-sorrow-website

Logs :

Set Up Job - Success
    Current runner version: '2.292.0'
    Operating System
    Virtual Environment
    Virtual Environment Provisioner
    GITHUB_TOKEN Permissions
    Secret source: Actions
    Prepare workflow directory
    Prepare all required actions
    Getting action download info
    Download action repository 'actions/checkout@v2' (SHA:7884fcad6b5d53d10323aee724dc68d8b9096a2e)
    Download action repository 'FirebaseExtended/action-hosting-deploy@v0' (SHA:276388dd6c2cde23455b30293105cc866c22282d)
    
Run actions/checkout@v2 - Success
    Run actions/checkout@v2
    Syncing repository: DarkSorrow/dark_sorrow_website
    Getting Git version info
    Temporarily overriding HOME='/home/runner/work/_temp/035a173a-a64e-4eee-b3b1-c8e6502002df' before making global git config changes
    Adding repository directory to the temporary git global config as a safe directory
    /usr/bin/git config --global --add safe.directory /home/runner/work/dark_sorrow_website/dark_sorrow_website
    Deleting the contents of '/home/runner/work/dark_sorrow_website/dark_sorrow_website'
    Initializing the repository
    Disabling automatic garbage collection
    Setting up auth
    Fetching the repository
    Determining the checkout info
    Checking out the ref
    /usr/bin/git log -1 --format='%H'
    '09cf2bf2181dcc67c98240d0d071055c04316434'
    
Run y - Failed
    Run y
        y
    shell: /usr/bin/bash -e ***0***
    /home/runner/work/_temp/5355644f-5a3f-43b1-8c1b-d8fb2dcb59a4.sh: line 1: y: command not found
    Error: Process completed with exit code 127.
    
Post Run actions/checkout@v2
    Post job cleanup.
    /usr/bin/git version
    git version 2.36.1
    Temporarily overriding HOME='/home/runner/work/_temp/b4322bb1-42c5-41e7-a65c-8f952ec64c2a' before making global git config changes
    Adding repository directory to the temporary git global config as a safe directory
    /usr/bin/git config --global --add safe.directory /home/runner/work/dark_sorrow_website/dark_sorrow_website
    /usr/bin/git config --local --name-only --get-regexp core\.sshCommand
    /usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
    /usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
    http.https://github.com/.extraheader
    /usr/bin/git config --local --unset-all http.https://github.com/.extraheader
    /usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
    
Complete Job    
    Cleaning up orphan processes

Upvotes: 0

Views: 784

Answers (1)

abraham
abraham

Reputation: 47833

The reason is in the error message.

The npm ci command can only install with an existing package-lock.json or npm-shrinkwrap.json

You either need to switch to npm i or commit package-lock.json to your git repo.

Upvotes: 1

Related Questions