簡體   English   中英

npm 錯誤! 在 github 操作上構建腳本期間失敗

[英]npm ERR! Failed during build script on github actions

我有用 React 編寫的前端應用程序。 我需要在 azure 上部署它。 此外,我必須使用 github 操作。 在構建過程中,我收到此錯誤:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react_with_mobix@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the react_with_mobix@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2021-06-25T18_19_29_860Z-debug.log
Error: Process completed with exit code 1.

我的 .yml 文件看起來:

name: Build and deploy Node.js app to Azure Web App - uj-ebiznes-front

on:
  push:
    branches:
      - master
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - name: Set up Node.js version
      uses: actions/setup-node@v1
      with:
        node-version: '14.x'

    - name: npm install, build, and test
      run: |
        CI=false npm install
        CI=false npm run build --if-present
    
    - name: 'Deploy to Azure Web App'
      id: deploy-to-webapp
      uses: azure/webapps-deploy@v2
      with:
        app-name: 'app_name'
        slot-name: 'production'
        publish-profile: //there's my secret
        package: .

我已經改變了運行線路:

run: |
        CI=false npm install
        CI=false npm run build --if-present

我在 github 問題和 stackOverflow 上發現了一些問題,答案在這一行中指出。 但這對我沒有幫助。

拜托,你能幫我嗎? 最好的祝福。

For npm error :-

嘗試使用.env在您的(VS)項目中創建一個新文件然后在.env文件中編寫以下代碼並保存。

`SKIP_PREFLIGHT_CHECK=true

上面的命令將幫助您解決npm error. 創建成功后,嘗試啟動 npm 並檢查。 這可以解決您的問題。

或者,有關將 node.js 應用程序配置為 azure Web 應用程序的更多信息,請參閱此MS Doc

node.js 應用程序從本地 Git存儲庫部署到應用服務到 Azure。 點擊這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM