问题
I'm trying to use the Heroku cli "keys" functions to upload a ssh key to my account. Unfortunately I run into the following error whenever I try to use any of the keys methods.
TypeError: Cannot read property 'run' of undefined
at Object.<anonymous> (C:\Users\Administrator\AppData\Local\heroku\tmp\heroku-script-292666295:14:4)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Function.Module.runMain (module.js:575:10)
at startup (node.js:159:18)
at node.js:444:3
Any thoughts would be greatly appreciated.
回答1:
After speaking with the Heroku support team we found that heroku update
fixed the problem.
回答2:
It seems, Heroku command facing trouble finding right version of ruby so its throwing the error.
Uninstall Heroku Toolbelt through Windows "Control Panel\Programs and Features" after successful uninstallation, delete C:\Program Files\Heroku folder as well.
And then reinstall Heroku Toolbelt and try to run the command. It should work.
回答3:
I removed this folder and all was well C:\Users\USERNAME.heroku.npm-cache
回答4:
Updating your package.json with the Node version you are using may fix this:
"engines": {
"node": "6.0.0"
},
I was using version 6.0.0 locally, but Heroku was downloading version 5.11.1.
回答5:
I solve this error unstalling node.js from windows and removing the content of heroku folder(in appdata), after that typed on the propty: heroku --version. heroku said me to update git to other version, I updated it. then I run the command to generate a key again and worked perfectly. This worked to me.
来源:https://stackoverflow.com/questions/37048456/heroku-keys-cannot-read-property-run-of-undefined