I am using circleci to build and deploy a node app. Everything works great until I run npm run build
. Sometimes, it succeeds and sometimes it fails with status code 1. There is no logical reason for the inconsistency.
I reached out to support but they haven’t responded for 2 weeks. I do not understand the problem since it is running perfectly in local machine and there’s no error output except the status code.
Am I missing anything?
build:
...
steps:
- checkout
- run:
name: Install tools
command: |
apt update
apt -y install --no-install-recommends lsb-release apt-transport-https cron coreutils ca-certificates curl tar gzip wget gnupg2 nano bash p7zip-full apt-utils
curl --silent --location https://deb.nodesource.com/setup_22.x | bash -
apt -y install --no-install-recommends nodejs
- run:
name: Authorize to NPM package
command: |
echo "//npm.pkg.github.com/:_authToken=${GITHUB_ACCESS_TOKEN}" > ~/.npmrc
echo "@eatzy:registry=https://npm.pkg.github.com" > app/.npmrc
- run:
name: Set package version
command: |
cd app
cat package.json | sed "s/\"version\":.*/\"version\": \"${CIRCLE_TAG}\"\,/g" > package.json.new
cat package.json.new > package.json
rm package.json.new
- run:
name: Install node dependencies and Run build
command: |
cd app
npm ci
APP_VERSION=${CIRCLE_TAG} npm run build