我使用react.js构建了web应用程序,我希望在每次提交时使用FTP在服务器上进行构建和部署。为此,我配置了bitbucket管道,但是在构建反应应用程序时遇到错误。
我通过运行" 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
这是bitbucket-pipeline配置:
image:node: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
我检查了node和npm版本与我在本地机器上使用的相同。
答案 0 :(得分:2)
将命令 npm run build
替换为 CI=false npm run build
这将解决您的问题