Npm install failing in one branch, but not the rest

Hi, we have multiple branches that push to CircleCI. On one of them, ‘production’, the command

npm install

fails during the ‘dependencies’ stage defined in circle.yml. This is the error message:

---------------------dependencies----------------------
npm install
ruby-2.2.3 - #gemset created /home/ubuntu/.rvm/gems/ruby-2.2.3@rework
ruby-2.2.3 - #generating rework wrappers|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.
npm WARN package.json rework@1.0.0 No license field.
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm ERR! Linux 3.14.28-031428-generic
npm ERR! argv "/home/ubuntu/nvm/versions/node/v4.0.0/bin/node" "/home/ubuntu/nvm/versions/node/v4.0.0/bin/npm" "install"
npm ERR! node v4.0.0
npm ERR! npm  v2.13.5
npm ERR! code 128

npm ERR! Command failed: git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ubuntu/ReWork-Web-Dev/npm-debug.log

npm install returned exit code 1

Action failed: npm install

Why is this command working on some branches, like development and staging, but not on the production branch?

Thanks!

The issue could be caused by a corrupted dependency cache on the production branch. As the cache is per-branch, other branches might not have the same issue. Did you try rebuilding without cache?

Hey Alexey, thanks for chipping in. We have tried rebuilding without cache and we still get an error, though it is a bit different. Here is what we got:

npm install
ruby-2.2.3 - #gemset created /home/ubuntu/.rvm/gems/ruby-2.2.3@rework
ruby-2.2.3 - #generating rework wrappers|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.
npm WARN package.json rework@1.0.0 No license field.
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm WARN optional dep failed, continuing imagemin-optipng@4.3.0
npm WARN optional dep failed, continuing imagemin-jpegtran@4.3.1
 

> spawn-sync@1.0.13 postinstall /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass/node_modules/cross-spawn/node_modules/spawn-sync
> node postinstall

 

> node-sass@3.3.3 install /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass
> node scripts/install.js

Binary downloaded and installed at /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass/vendor/linux-x64-46/binding.node

 

> node-sass@3.3.3 postinstall /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass
> node scripts/build.js

` /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass/vendor/linux-x64-46/binding.node ` exists. 
 testing binary.
Binary is fine; exiting.
npm ERR! Linux 3.14.28-031428-generic
npm ERR! argv "/home/ubuntu/nvm/versions/node/v4.0.0/bin/node" "/home/ubuntu/nvm/versions/node/v4.0.0/bin/npm" "install"
npm ERR! node v4.0.0
npm ERR! npm  v2.13.5
npm ERR! code 128

npm ERR! Command failed: git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ubuntu/ReWork-Web-Dev/npm-debug.log

npm install returned exit code 1

Action failed: npm install

Any other thoughts that could help here? Thanks!

That’s interesting—I’ve just deleted the source cache for your project on our side, could you please check if there are any changes to how the build behaves?

Thanks Alexey. I tried it again and got this error:

npm install
ruby-2.2.3 - #gemset created /home/ubuntu/.rvm/gems/ruby-2.2.3@rework
ruby-2.2.3 - #generating rework wrappers|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.
npm WARN package.json rework@1.0.0 No license field.
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm WARN optional dep failed, continuing imagemin-jpegtran@4.3.1
npm WARN optional dep failed, continuing imagemin-optipng@4.3.0
 

> spawn-sync@1.0.13 postinstall /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass/node_modules/cross-spawn/node_modules/spawn-sync
> node postinstall

 

> node-sass@3.3.3 install /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass
> node scripts/install.js

Binary downloaded and installed at /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass/vendor/linux-x64-46/binding.node

 

> node-sass@3.3.3 postinstall /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass
> node scripts/build.js

` /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass/vendor/linux-x64-46/binding.node ` exists. 
 testing binary.
Binary is fine; exiting.
npm ERR! Linux 3.14.28-031428-generic
npm ERR! argv "/home/ubuntu/nvm/versions/node/v4.0.0/bin/node" "/home/ubuntu/nvm/versions/node/v4.0.0/bin/npm" "install"
npm ERR! node v4.0.0
npm ERR! npm  v2.13.5
npm ERR! code 128

npm ERR! Command failed: git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ubuntu/ReWork-Web-Dev/npm-debug.log

npm install returned exit code 1

Action failed: npm install

I am glad it is not just confusing for us : )

One thing that could be causing this: by default we’ll do a shallow clone of your repo, and now that npm tries to rev-list a certain revision, it might not be finding the one it’s looking for, and therefore failing.

Could you please try un-shallowing the clone before running npm install? Something like this in your circle.yml should do:

test:
  pre:
    - "[[ ! -s \"$(git rev-parse --git-dir)/shallow\" ]] || git fetch --unshallow"
2 Likes

Thank you Alexey,

After cleaning the cache, all branches are failing : ) at least now it is less confusing. We are getting the same error on all branches for npm install. We tried with the un-shallowing too but there was no luck. Not sure if this is related to the environment of CircleCI or to our environment… but we will work to figure this out. This is the error we are getting:

npm install
ruby-2.2.3 - #gemset created /home/ubuntu/.rvm/gems/ruby-2.2.3@rework
ruby-2.2.3 - #generating rework wrappers|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.
npm WARN package.json rework@1.0.0 No license field.
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba: 
npm WARN optional dep failed, continuing imagemin-optipng@4.3.0
npm WARN optional dep failed, continuing imagemin-jpegtran@4.3.1
 

> spawn-sync@1.0.13 postinstall /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass/node_modules/cross-spawn/node_modules/spawn-sync
> node postinstall

 

> node-sass@3.3.3 install /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass
> node scripts/install.js

Binary downloaded and installed at /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass/vendor/linux-x64-46/binding.node

 

> node-sass@3.3.3 postinstall /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass
> node scripts/build.js

` /home/ubuntu/ReWork-Web-Dev/node_modules/node-sass/vendor/linux-x64-46/binding.node ` exists. 
 testing binary.
Binary is fine; exiting.
npm ERR! Linux 3.14.28-031428-generic
npm ERR! argv "/home/ubuntu/nvm/versions/node/v4.0.0/bin/node" "/home/ubuntu/nvm/versions/node/v4.0.0/bin/npm" "install"
npm ERR! node v4.0.0
npm ERR! npm  v2.13.5
npm ERR! code 128

npm ERR! Command failed: git rev-list -n1 ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! fatal: bad object ee4cf132bac743f75b4e2cd486b7f4be204e29ba
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ubuntu/ReWork-Web-Dev/npm-debug.log

npm install returned exit code 1

Action failed: npm install

Thanks for your help Alexey.

It would be important to understand where that ref, ee4cf132bac743f75b4e2cd486b7f4be204e29ba comes from. Unshallowing should have helped if npm is looking for that revision in the project you are building, but I’m not sure if it’s looking fir that in the project tree or somewhere else.

Hey @raulsann, have you been able to find something out about this issue?

1 Like

Hi @alexey! Thank you so much for following up. Unfortunately, we have not being able to fix this issue. At the moment we are bypassing CircleCI when we push code… It sucks but this has been quite a tricky issue to solve : ). I will let you know if we are able to solve it. Thank you!

I don’t know if this is related, but https://www.npmjs.com/package/rework appears to be at 1.0.1 as of ~ 1 year ago, not sure why you are trying to use 1.0.0, could that be partly the problem?

1 Like

Hi drazisil, we are not using https://www.npmjs.com/package/rework. Rework is the name of our own package and we are at version 1.0.0 : ). Though it was a great suggestion. Thank you!