Closed sagarpatke closed 7 years ago
Same problem here, it works only if i run ./node_modules/sidekick/sidekick.js init
but now with sidekick init
@sagarpatke any chance you can provide a stack trace for this please?
If you run sidekick with DEBUG=* sidekick init
then you'll get the full debug info.
Launching DEBUG=* sidekick init
i get this:
common:userSettings loading user config file: /home/pietro/.local/sidekick/SidekickConfig.json +0ms
common:userSettings no config file +2ms
git-plan setting gitBin to : git +1ms
cli *** CLI STARTUP *** +238ms
cli:init command: {} +1ms
cli:init Unable to run init: not a git repo - this operation can only be performed in a git repo +8ms
Unable to create .sidekickrc. Cannot find repo root.
cli uncaughtException! TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.join (path.js:1211:7)
at /home/pietro/.nvm/versions/node/v7.1.0/lib/node_modules/sidekick/src/init.js:44:36
at tryCatcher (/home/pietro/.nvm/versions/node/v7.1.0/lib/node_modules/sidekick/node_modules/bluebird/js/main/util.js:26:23)
at Promise.errorAdapter (/home/pietro/.nvm/versions/node/v7.1.0/lib/node_modules/sidekick/node_modules/bluebird/js/main/nodeify.js:36:34)
at Promise._settlePromiseAt (/home/pietro/.nvm/versions/node/v7.1.0/lib/node_modules/sidekick/node_modules/bluebird/js/main/promise.js:575:21)
at Promise._settlePromises (/home/pietro/.nvm/versions/node/v7.1.0/lib/node_modules/sidekick/node_modules/bluebird/js/main/promise.js:693:14)
at Async._drainQueue (/home/pietro/.nvm/versions/node/v7.1.0/lib/node_modules/sidekick/node_modules/bluebird/js/main/async.js:123:16)
at Async._drainQueues (/home/pietro/.nvm/versions/node/v7.1.0/lib/node_modules/sidekick/node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues (/home/pietro/.nvm/versions/node/v7.1.0/lib/node_modules/sidekick/node_modules/bluebird/js/main/async.js:15:14)
at runCallback (timers.js:637:20)
at tryOnImmediate (timers.js:610:5)
at processImmediate [as _immediateCallback] (timers.js:582:5) +3ms
sk suffered an unexpected error cli exit 1 +10ms
I'm definitely sure the folder from which i launch the command is a git repo.
@pietrovismara thanks! I'll take a look.
@pietrovismara so tracing through the code, we walked up the directory tree from the location you ran sidekick init
in. We couldn't find a .git
directory until we hit /
. This suggests that you were running sidekick init
in a directory that was not a git repo, and where no parent directories were git repos.
Can you run git rev-parse --is-inside-work-tree
in the directory that you tried sidekick init
in please and let me know the output?
I'm 101% sure my folder is a git repository, and git rev-parse --is-inside-work-tree
returns true
BTW If you need, you can provide me with fixed code and i can test it on my machine.
@rishson The directory where I executed the command is a git repository, and has a .git folder.
@rishson I was going through sidekick/src/init.js:44:36
I believe the catch is that, sidekick is installed globally, and not in the node_modules of the local repository. Hence, it's not able to find the git repository.
Changing __dirname to process.cwd() seems to work well.
Pull Request: https://github.com/sidekickcode/sidekick/pull/4
Regards
@sagarpatke you are of course correct! Thanks for your PR. I've merged and will release 0.12.1 when I've also fixed #3, which I'm looking at now.
Code snippet
However, when sidekick is installed locally in the project, it works fine.