Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre-commit hook fails for no reason #4

Closed
sudo-suhas opened this issue Sep 19, 2017 · 2 comments · Fixed by #5
Closed

pre-commit hook fails for no reason #4

sudo-suhas opened this issue Sep 19, 2017 · 2 comments · Fixed by #5

Comments

@sudo-suhas
Copy link
Contributor

  • kcd-scripts version: 0.0.0-semantically-released 😉
  • node version: 8.5.0
  • npm version: 5.3.0
  • yarnversion: 1.0.2

What you did:
git commit

What happened:

husky > npm run -s precommit (node v8.5.0)

25l[09:24:02] Running tasks for **/*.+(js|json|less|css|ts) [started]
[09:24:02] Running tasks for .all-contributorsrc [started]
[09:24:02] Running tasks for .all-contributorsrc [skipped]
[09:24:02] → No staged files match .all-contributorsrc
[09:24:02] kcd-scripts format [started]
[09:24:03] kcd-scripts format [completed]
[09:24:03] kcd-scripts lint [started]
[09:24:05] kcd-scripts lint [completed]
[09:24:05] kcd-scripts test --findRelatedTests [started]
[09:24:07] kcd-scripts test --findRelatedTests [completed]
[09:24:07] git add [started]
[09:24:07] git add [completed]
[09:24:07] Running tasks for **/*.+(js|json|less|css|ts) [completed]
25h25h
husky > pre-commit hook failed (add --no-verify to bypass)
verbose npm output
husky > npm run -s precommit (node v8.5.0)


> kcd-scripts@0.0.0-semantically-released precommit E:\Projects\repos\kcd-scripts
> node src precommit

25l[09:25:15] Running tasks for **/*.+(js|json|less|css|ts) [started]
[09:25:15] Running tasks for .all-contributorsrc [started]
[09:25:15] Running tasks for .all-contributorsrc [skipped]
[09:25:15] → No staged files match .all-contributorsrc
[09:25:15] kcd-scripts format [started]
[09:25:16] kcd-scripts format [completed]
[09:25:16] kcd-scripts lint [started]
[09:25:18] kcd-scripts lint [completed]
[09:25:18] kcd-scripts test --findRelatedTests [started]
[09:25:20] kcd-scripts test --findRelatedTests [completed]
[09:25:20] git add [started]
[09:25:20] git add [completed]
[09:25:20] Running tasks for **/*.+(js|json|less|css|ts) [completed]
25h25hnpm WARN invalid config access=undefined
npm WARN invalid config also=undefined
npm WARN invalid config https-proxy=undefined
npm WARN invalid config Must be a full url with 'http://'
npm WARN invalid config init-author-url=undefined
npm WARN invalid config Must be a full url with 'http://'
npm WARN invalid config only=undefined
npm WARN invalid config proxy=undefined
npm WARN invalid config Must be a full url with 'http://'
npm WARN onload-script failed to require onload script undefined
npm WARN onload-script Error: Cannot find module 'undefined'
npm WARN onload-script     at Function.Module._resolveFilename (module.js:527:15)
npm WARN onload-script     at Function.Module._load (module.js:476:23)
npm WARN onload-script     at Module.require (module.js:568:17)
npm WARN onload-script     at require (internal/module.js:11:18)
npm WARN onload-script     at cb (C:\nvm\v8.5.0\node_modules\npm\lib\npm.js:225:11)
npm WARN onload-script     at C:\nvm\v8.5.0\node_modules\npm\lib\npm.js:356:16
npm WARN onload-script     at C:\nvm\v8.5.0\node_modules\npm\lib\config\core.js:81:7
npm WARN onload-script     at Array.forEach (<anonymous>)
npm WARN onload-script     at C:\nvm\v8.5.0\node_modules\npm\lib\config\core.js:80:13
npm WARN onload-script     at f (C:\nvm\v8.5.0\node_modules\npm\node_modules\once\once.js:25:25)
npm WARN onload-script  { Error: Cannot find module 'undefined'
npm WARN onload-script     at Function.Module._resolveFilename (module.js:527:15)
npm WARN onload-script     at Function.Module._load (module.js:476:23)
npm WARN onload-script     at Module.require (module.js:568:17)
npm WARN onload-script     at require (internal/module.js:11:18)
npm WARN onload-script     at cb (C:\nvm\v8.5.0\node_modules\npm\lib\npm.js:225:11)
npm WARN onload-script     at C:\nvm\v8.5.0\node_modules\npm\lib\npm.js:356:16
npm WARN onload-script     at C:\nvm\v8.5.0\node_modules\npm\lib\config\core.js:81:7
npm WARN onload-script     at Array.forEach (<anonymous>)
npm WARN onload-script     at C:\nvm\v8.5.0\node_modules\npm\lib\config\core.js:80:13
npm WARN onload-script     at f (C:\nvm\v8.5.0\node_modules\npm\node_modules\once\once.js:25:25)
npm WARN onload-script   stack: 'Error: Cannot find module \'undefined\'\n    at Function.Module._resolveFilename (module.js:527:15)\n    at Function.Module._load (module.js:476:23)\n    at Module.require (module.js:568:17)\n    at require (internal/module.js:11:18)\n    at cb (C:\\nvm\\v8.5.0\\node_modules\\npm\\lib\\npm.js:225:11)\n
    at C:\\nvm\\v8.5.0\\node_modules\\npm\\lib\\npm.js:356:16\n    at C:\\nvm\\v8.5.0\\node_modules\\npm\\lib\\config\\core.js:81:7\n    at Array.forEach (<anonymous>)\n    at C:\\nvm\\v8.5.0\\node_modules\\npm\\lib\\config\\core.js:80:13\n    at f (C:\\nvm\\v8.5.0\\node_modules\\npm\\node_modules\\once\\once.js:25:25)',
npm WARN onload-script   code: 'MODULE_NOT_FOUND' }
npm WARN invalid config access=undefined
npm WARN invalid config also=undefined
npm WARN invalid config https-proxy=undefined
npm WARN invalid config Must be a full url with 'http://'
npm WARN invalid config init-author-url=undefined
npm WARN invalid config Must be a full url with 'http://'
npm WARN invalid config only=undefined
npm WARN invalid config proxy=undefined
npm WARN invalid config Must be a full url with 'http://'
npm WARN onload-script failed to require onload script undefined
npm WARN onload-script Error: Cannot find module 'undefined'
npm WARN onload-script     at Function.Module._resolveFilename (module.js:527:15)
npm WARN onload-script     at Function.Module._load (module.js:476:23)
npm WARN onload-script     at Module.require (module.js:568:17)
npm WARN onload-script     at require (internal/module.js:11:18)
npm WARN onload-script     at cb (C:\nvm\v8.5.0\node_modules\npm\lib\npm.js:225:11)
npm WARN onload-script     at C:\nvm\v8.5.0\node_modules\npm\lib\npm.js:356:16
npm WARN onload-script     at C:\nvm\v8.5.0\node_modules\npm\lib\config\core.js:81:7
npm WARN onload-script     at Array.forEach (<anonymous>)
npm WARN onload-script     at C:\nvm\v8.5.0\node_modules\npm\lib\config\core.js:80:13
npm WARN onload-script     at f (C:\nvm\v8.5.0\node_modules\npm\node_modules\once\once.js:25:25)
npm WARN onload-script  { Error: Cannot find module 'undefined'
npm WARN onload-script     at Function.Module._resolveFilename (module.js:527:15)
npm WARN onload-script     at Function.Module._load (module.js:476:23)
npm WARN onload-script     at Module.require (module.js:568:17)
npm WARN onload-script     at require (internal/module.js:11:18)
npm WARN onload-script     at cb (C:\nvm\v8.5.0\node_modules\npm\lib\npm.js:225:11)
npm WARN onload-script     at C:\nvm\v8.5.0\node_modules\npm\lib\npm.js:356:16
npm WARN onload-script     at C:\nvm\v8.5.0\node_modules\npm\lib\config\core.js:81:7
npm WARN onload-script     at Array.forEach (<anonymous>)
npm WARN onload-script     at C:\nvm\v8.5.0\node_modules\npm\lib\config\core.js:80:13
npm WARN onload-script     at f (C:\nvm\v8.5.0\node_modules\npm\node_modules\once\once.js:25:25)
npm WARN onload-script   stack: 'Error: Cannot find module \'undefined\'\n    at Function.Module._resolveFilename (module.js:527:15)\n    at Function.Module._load (module.js:476:23)\n    at Module.require (module.js:568:17)\n    at require (internal/module.js:11:18)\n    at cb (C:\\nvm\\v8.5.0\\node_modules\\npm\\lib\\npm.js:225:11)\n
    at C:\\nvm\\v8.5.0\\node_modules\\npm\\lib\\npm.js:356:16\n    at C:\\nvm\\v8.5.0\\node_modules\\npm\\lib\\config\\core.js:81:7\n    at Array.forEach (<anonymous>)\n    at C:\\nvm\\v8.5.0\\node_modules\\npm\\lib\\config\\core.js:80:13\n    at f (C:\\nvm\\v8.5.0\\node_modules\\npm\\node_modules\\once\\once.js:25:25)',
npm WARN onload-script   code: 'MODULE_NOT_FOUND' }

> kcd-scripts@0.0.0-semantically-released validate E:\Projects\repos\kcd-scripts
> node src validate

npm ERR! file undefined
npm ERR! path undefined
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn undefined
npm ERR! kcd-scripts@0.0.0-semantically-released validate: `node src validate`
npm ERR! spawn undefined ENOENT
npm ERR!
npm ERR! Failed at the kcd-scripts@0.0.0-semantically-released validate script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! code ELIFECYCLE
npm ERR! errno -4058
npm ERR! kcd-scripts@0.0.0-semantically-released validate: `node src validate`
npm ERR! Exit status -4058
npm ERR!
npm ERR! Failed at the kcd-scripts@0.0.0-semantically-released validate script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\suhas.karanth\AppData\Roaming\npm-cache\_logs\2017-09-19T03_55_21_615Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! kcd-scripts@0.0.0-semantically-released precommit: `node src precommit`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the kcd-scripts@0.0.0-semantically-released precommit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\suhas.karanth\AppData\Roaming\npm-cache\_logs\2017-09-19T03_55_21_791Z-debug.log

husky > pre-commit hook failed (add --no-verify to bypass)

Problem description:

This is related to the issue I had faced with opt-cli - ta2edchimp/opt-cli#213.
Invoking spawn with env having undefined values breaks npm.

Suggested solution:

While I know how to fix the issue, in kcd-scripts, I am wondering if the fix should be in cross-spawn or even npm.

@kentcdodds
Copy link
Owner

Thank you so much for this! I really appreciate it :)

Sounds like a problem that npm or cross-spawn should solve. Would you like to open an issue there and then we can do a (hopefully) temporary fix here?

@sudo-suhas
Copy link
Contributor Author

@kentcdodds I have made a PR with the temporary fix, will follow up with cross-spawn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants