Skip to content

Instantly share code, notes, and snippets.

@mariash
Created October 11, 2012 23:27
Show Gist options
  • Save mariash/3876315 to your computer and use it in GitHub Desktop.
Save mariash/3876315 to your computer and use it in GitHub Desktop.
NPM saving current configuration in package.json and exit code 0 on failure
#!/bin/bash
# NPM_0_6_12=~/.nvm/v0.6.12/bin/npm NPM_0_6_8=~/.nvm/v0.6.8/bin/npm ./npm-install-problem.sh
# Install module with npm from node v0.6.12 and then use npm from node v0.6.8 to rebuild it and see it fail
# + exit code is 0 with the force option even on failure
# Npm saves install information in package.json so next time npm build is run on package with different configuration it may fail
$NPM_0_6_12 install bcrypt@0.7.2
cd ./node_modules/bcrypt
# package.json was updated with scripts -> install that looks like "node-gyp rebuild"
# 0.6.8 does not have node-gyp tool
# If --force is used exitstatus is 0 even if failed
$NPM_0_6_8 build . --force # fails
echo $? # outputs 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment