简体   繁体   English

Bitbucket 管道 reactjs 构建错误

[英]Bitbucket pipeline reactjs build error

I built web app using react.js, and I want to make build and deploy on the server using FTP on every commit.我使用 react.js 构建了 Web 应用程序,并且我想在每次提交时使用 FTP 在服务器上进行构建和部署。 For that purpose, I configure bitbucket pipeline, but I get an error on build react app.为此,我配置了 bitbucket 管道,但在构建 react 应用程序时出现错误。

I tested my local machine by running "npm run build" command and it run successfully without any error, but on pipeline, I get the following error:我通过运行“npm run build”命令测试了我的本地机器,它成功运行,没有任何错误,但在管道上,我收到以下错误:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-app@0.1.0 build: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the react-app@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! /root/.npm/_logs/2018-05-16T13_18_01_726Z-debug.log

Here is bitbucket-pipeline configuration:这是 bitbucket-pipeline 配置:

image: node:8.11.1-slim图像:节点:8.11.1-slim

pipelines:
default:
- step:
script:
- echo "This script runs only on staging branch"
branches:
staging:
- step:
caches:
- node
script: 
- npm install
- node --version
- npm --version
- npm run build
- apt-get update
- apt-get -qq install git-ftp
- git ftp init --user $FTP_USERNAME --passwd $FTP_PASSWORD -v $FTP_HOST

I checked node and npm version are same as I using on my local machine.我检查了 node 和 npm 版本与我在本地机器上使用的相同。

Replace the command npm run build to CI=false npm run build将命令npm run build替换为CI=false npm run build

this will resolve your problem这将解决您的问题

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

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