简体   繁体   English

npm 错误! 在 github 操作上构建脚本期间失败

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

I have frontend app written in react.我有用 React 编写的前端应用程序。 I need to deploy it on azure.我需要在 azure 上部署它。 Moreover i have to use github actions.此外,我必须使用 github 操作。 During building i get this error:在构建过程中,我收到此错误:

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.

My .yml file looks:我的 .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: .

I have already changed line with run on:我已经改变了运行线路:

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

I found some questions on github issues and on stackOverflow where answers indicate on this line.我在 github 问题和 stackOverflow 上发现了一些问题,答案在这一行中指出。 But it didn't help me.但这对我没有帮助。

Please, could you help me?拜托,你能帮我吗? Best regards.最好的祝福。

For npm error :- For npm error :-

Try with Create a new file inside your(VS) project with .env Then inside the .env file write this following code and save it.尝试使用.env在您的(VS)项目中创建一个新文件然后在.env文件中编写以下代码并保存。

`SKIP_PREFLIGHT_CHECK=true `SKIP_PREFLIGHT_CHECK=true

The above command will help you in resolving the npm error.上面的命令将帮助您解决npm error. After successfully create then try to start the npm and check.创建成功后,尝试启动 npm 并检查。 This can be work for your issue.这可以解决您的问题。

Or, For more information about configuring your node.js app to azure web app Refer this MS Doc .或者,有关将 node.js 应用程序配置为 azure Web 应用程序的更多信息,请参阅此MS Doc

Deploy the node.js app to App Service from your local Git repository to Azure.node.js 应用程序从本地 Git存储库部署到应用服务到 Azure。 Click here .点击这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM