Npm issues on bitrise

We will collect npm issues and possible solutions in this thread.

If you receive following issue in npm step, using the install command:

e[00;34mConfigs:e[0m
  * workdir: /Users/vagrant/git
  * command: install

e[00;34mSwitching to working directory: /Users/vagrant/gite[0m

e[00;34mRun npm commande[0m
+ npm install
npm ERR! Cannot read property 'find' of undefined
npm ERR! Cannot read property 'find' of undefined
npm ERR! Cannot read property 'find' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/vagrant/.npm/_logs/2017-08-29T16_08_09_148Z-debug.log

For first add a script step after the npm install step to print the content of the debug log file:

#!/bin/bash
set -ex
cat $(find $HOME/.npm/_logs -name '*-debug.log')

Set the new script step’s Run if previous Step failed flag to true, to let the step run even if previous failed.

If you can not find the solution based on the log file’s content you may try to update npm and clear the npm cache, by adding a new script step before npm install step:

#!/bin/bash
set -ex
npm i -g npm@latest
rm -rf $HOME/.npm
npm cache verify