Skip to content

Commit 3ea9139

Browse files
ta2edchimpKent C. Dodds
authored andcommitted
fix(install): fail gracefully on occasional npm@2.15 hickups (#109)
* fix(install): fail gracefully on occasional npm@2.15 hickups * docs(install): use `npm explore` to rerun install script ... as well as mention the original issue on GitHub.
1 parent 817f3dc commit 3ea9139

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

bin/module-install

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env node
2+
try {
3+
const opt = require('opt-cli')
4+
if (!opt.testOptOut('ghooks-install')) {
5+
require('./install')
6+
}
7+
} catch (e) {
8+
console.warn( // eslint-disable-line no-console
9+
'\nghooks postinstall could not be completed.\n' +
10+
'==========================================\n\n' +
11+
'Usually this is due to using npm@2.15.x. Please consider updating npm\n' +
12+
'to its latest version or run the following command manually afterwards:\n\n' +
13+
'\tnpm explore ghooks -- npm run install\n\n' +
14+
'See https://github.com/gtramontina/ghooks/issues/71 for more information.\n'
15+
)
16+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"report-coverage": "cat ./coverage/lcov.info | node_modules/.bin/codecov",
3030
"validate": "npm t && npm run check-coverage",
3131
"commit": "git-cz",
32-
"install": "opt --out ghooks-install --exec \"node ./bin/install\"",
32+
"install": "node ./bin/module-install",
3333
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
3434
},
3535
"dependencies": {

0 commit comments

Comments
 (0)