# Circle-Ci build failed

**URL:** <https://discuss.circleci.com/t/circle-ci-build-failed/26498>\
**Category:** Build Environment\
**Tags:** nodejs\
**Created:** [November 14, 2018, 2:52am UTC](https://discuss.circleci.com/t/circle-ci-build-failed/26498 "2018-11-14T02:52:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![UmairNazir](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/umairnazir/32/19729_2.png) [@UmairNazir](https://discuss.circleci.com/u/UmairNazir)\
**Post date:** [November 14, 2018, 2:52am UTC](https://discuss.circleci.com/t/circle-ci-build-failed/26498/1 "2018-11-14T02:52:59Z")

</div>

I am deploying my application at staging server. But it is failing during deployment and showing this error.

remote: -----\> Building dependencies  
remote: Installing node modules (package.json + package-lock)  
remote: Unhandled rejection Error: Command failed: /usr/bin/git checkout 4.0  
remote: error: pathspec ‘4.0’ did not match any file(s) known to git.  
remote:  
remote: at ChildProcess.exithandler (child\_process.js:276:12)  
remote: at emitTwo (events.js:126:13)  
remote: at ChildProcess.emit (events.js:214:7)  
remote: at maybeClose (internal/child\_process.js:915:16)  
remote: at Socket.stream.socket.on (internal/child\_process.js:336:11)  
remote: at emitOne (events.js:116:13)  
remote: at Socket.emit (events.js:211:7)  
remote: at Pipe.\_handle.close [as \_onclose] (net.js:561:12)  
remote: npm ERR! write after end  
remote: npm ERR! write after end  
remote: npm ERR! write after end  
remote: npm ERR! write after end  
remote: npm ERR! write after end  
remote:  
remote: npm ERR! A complete log of this run can be found in:  
remote: npm ERR! /tmp/npmcache.eZko6/\_logs/2018-11-14T02\_34\_09\_121Z-debug.log  
remote:  
remote: -----\> Build failed  
remote:  
remote: We’re sorry this build is failing! You can troubleshoot common issues here:  
remote: [https://devcenter.heroku.com/articles/troubleshooting-node-deploys](https://devcenter.heroku.com/articles/troubleshooting-node-deploys)  
remote:  
remote: If you’re stuck, please submit a ticket so we can help:  
remote: [https://help.heroku.com/](https://help.heroku.com/)  
remote:  
remote: Love,  
remote: Heroku  
remote:  
remote: ! Push rejected, failed to compile Node.js app.  
remote:  
remote: ! Push failed  
remote: Verifying deploy…  
remote:  
remote: ! Push rejected to drbeen-stage.  
remote:  
To [https://heroku:ca3eaeab-23c3-40a2-947f-82bb98e68276@git.heroku.com/drbeen-stage.git](https://heroku:ca3eaeab-23c3-40a2-947f-82bb98e68276@git.heroku.com/drbeen-stage.git)  
! [remote rejected] master -\> master (pre-receive hook declined)

whats the issue? Kindly guide me about this.

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [November 14, 2018, 8:05am UTC](https://discuss.circleci.com/t/circle-ci-build-failed/26498/2 "2018-11-14T08:05:32Z")

</div>

It looks like you don’t have a tag or branch called `4.0` as you expect. Please supply your `config.yml` in a formatted block so that readers stand a reasonable chance of being able to help - it is unlikely people can assist otherwise.

You may also need to explain how your deployment works e.g. whether you are using an `ssh` command, or a remote `heroku` command, etc.

---

<div class="post-metadata">

**Author:** ![UmairNazir](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/umairnazir/32/19729_2.png) [@UmairNazir](https://discuss.circleci.com/u/UmairNazir)\
**Post date:** [November 14, 2018, 2:45pm UTC](https://discuss.circleci.com/t/circle-ci-build-failed/26498/3 "2018-11-14T14:45:53Z")

</div>

here is my config.yml for deployment

jobs:  
build-and-test:  
working\_directory: ~/drbeen.com  
docker:  
- image: node:8  
steps:  
- checkout  
- restore\_cache:  
key: drbeen-{{ arch }}-{{ .Branch }}-{{ checksum “package-lock.json” }}  
- run:  
name: install npm stuff  
command: npm install  
- save\_cache:  
key: drbeen-{{ arch }}-{{ .Branch }}-{{ checksum “package-lock.json” }}  
paths:  
- node\_modules  
# - run:  
# name: test  
# command: npm test  
deploy-stage:  
working\_directory: ~/drbeen.com  
docker:  
- image: node:8  
steps:  
- checkout  
- restore\_cache:  
key: drbeen-{{ arch }}-{{ .Branch }}-{{ checksum “package-lock.json” }}  
- run:  
name: install npm stuff  
command: npm install  
- save\_cache:  
key: drbeen-{{ arch }}-{{ .Branch }}-{{ checksum “package-lock.json” }}  
paths:  
- node\_modules  
# - run:  
# name: test  
# command: npm test  
- deploy:  
name: heroku setup  
command: |  
# wget [https://cli-assets.heroku.com/branches/stable/heroku-linux-amd64.tar.gz](https://cli-assets.heroku.com/branches/stable/heroku-linux-amd64.tar.gz) -O heroku.tar.gz  
# tar -xvzf heroku.tar.gz  
# ./heroku/install  
wget -qO- [https://cli-assets.heroku.com/install-ubuntu.sh](https://cli-assets.heroku.com/install-ubuntu.sh) | sh  
cat \>~/.netrc \<\<EOF  
machine [api.heroku.com](http://api.heroku.com)  
login $HEROKU\_EMAIL  
password $HEROKU\_TOKEN  
machine [git.heroku.com](http://git.heroku.com)  
login $HEROKU\_EMAIL  
password HEROKU\_TOKEN EOF chmod 600 ~/.netrc ssh-keygen -R heroku.com ssh-keyscan -H heroku.com \>\> ~/.ssh/known\_hosts - deploy: command: | heroku config:set COMMIT=(git rev-parse --short HEAD) --app drbeen-stage  
git push --force [https://heroku:$HEROKU\_API\_KEY@git.heroku.com/drbeen-stage.git](https://heroku:%24HEROKU_API_KEY@git.heroku.com/drbeen-stage.git) master  
#git push --force [git@heroku.com](mailto:git@heroku.com):drbeen-stage.git $CIRCLE\_SHA1:refs/heads/master  
heroku run ./node\_modules/migrate-mongo/bin/migrate-mongo.js -f config/index.js up --app drbeen-stage

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [November 14, 2018, 7:16pm UTC](https://discuss.circleci.com/t/circle-ci-build-failed/26498/4 "2018-11-14T19:16:56Z")

</div>

> [@halfer](#):
>
> Please supply your config.yml in a **formatted** block

🙂

---

<div class="post-metadata">

**Author:** ![nicolas-albert](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/nicolas-albert/32/16544_2.png) [@nicolas-albert](https://discuss.circleci.com/u/nicolas-albert)\
**Post date:** [January 4, 2019, 10:04am UTC](https://discuss.circleci.com/t/circle-ci-build-failed/26498/5 "2019-01-04T10:04:43Z")

</div>

This look like my actual case and also the followings:

> [@Fetching $CIRCLE\_TAG doesn't seem to work](https://discuss.circleci.com/t/fetching-circle-tag-doesnt-seem-to-work/19014):
>
> During the checkout process, it looks like CircleCI is basically executing the following sequence of commands: git fetch --force origin "refs/tags/${CIRCLE\_TAG}" git reset --hard "$CIRCLE\_SHA1" git checkout -q "$CIRCLE\_TAG" Unfortunately, I get an error message when it tries to checkout the tag. error: pathspec 'release-2017-12-22T15\_28\_47-05\_00' did not match any file(s) known to git. Exited with code 1 Any idea what’s going on here?

[https://discuss.circleci.com/t/builds-using-git-tags-failing/14904](https://discuss.circleci.com/t/builds-using-git-tags-failing/14904)

Their solution was to disable cache of the .git folder before the checkout (to speedup checkout).  
I’m sure it work but the checkout time can be long on some projects and their is no --depth configuration for git to save some data transfer.

---

<div class="post-metadata">

**Author:** ![halfer](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/halfer/32/9083_2.png) [@halfer](https://discuss.circleci.com/u/halfer)\
**Post date:** [January 5, 2019, 7:25pm UTC](https://discuss.circleci.com/t/circle-ci-build-failed/26498/6 "2019-01-05T19:25:46Z")

</div>

> [@nicolas-albert](#):
>
> [there] is no --depth configuration for git to save some data transfer

True, but the `checkout` command is optional - you can just use `git` if you are willing to do the checkout manually, which in turn will allow you to do a shallow clone.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [April 5, 2019, 7:25pm UTC](https://discuss.circleci.com/t/circle-ci-build-failed/26498/7 "2019-04-05T19:25:55Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
