Skip to content

Instantly share code, notes, and snippets.

@andrewagain
Last active August 29, 2015 14:27
Show Gist options
  • Save andrewagain/e324c6b0901b6a30a5ea to your computer and use it in GitHub Desktop.
Save andrewagain/e324c6b0901b6a30a5ea to your computer and use it in GitHub Desktop.
npm shrinkwrap validation errors
# ESLint is at 1.0.0 in package.json
$ cat package.json
{
"name": "npm-shrinkwrap-test",
"version": "0.0.1",
"dependencies": {
"eslint": "1.0.0"
}
}
# ESLint is at 1.0.0 in npm-shrinkwrap.json
$ cat npm-shrinkwrap.json | grep eslint
"eslint": {
"from": "eslint@1.0.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-1.0.0.tgz",
# Git status is clean
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
# Edit package.json. Update eslint to 1.1.0
$ cat package.json
{
"name": "npm-shrinkwrap-test",
"version": "0.0.1",
"dependencies": {
"eslint": "1.1.0"
}
}
# Developer commits - should have updated npm-shrinkwrap.json, but didn't. CI better catch this!
$ git commit -am 'Update eslint to 1.1.0'
[master d8c8bcf] Update eslint to 1.1.0
1 file changed, 1 insertion(+), 1 deletion(-)
# CI runs 'npm shrinkwrap' to make sure everything is OK. Gets this:
# Note the 'invalid: eslint@1.0.0'
npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "shrinkwrap"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! Problems were encountered
npm ERR! Please correct and try again.
npm ERR! invalid: eslint@1.0.0 /Users/ahfarmer/dev/workshop-2015/npm-shrinkwrap-test/node_modules/eslint
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! /Users/ahfarmer/dev/workshop-2015/npm-shrinkwrap-test/npm-debug.log
# If the developer wants to fix this, they just run:
$ rm npm-shrinkwrap.json
$ npm install
$ npm shrinkwrap
# Then commit the updated npm-shrinkwrap.json file.
# Now 'npm shrinkwrap' runs without errors.
$ npm shrinkwrap
wrote npm-shrinkwrap.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment