cdk8s-team / cdk8s

Define Kubernetes native apps and abstractions using object-oriented programming
https://cdk8s.io
Apache License 2.0
4.36k stars 294 forks source link

[BUG] cdk8s init throws error on missing prerequisites #163

Closed ankitmahapatra22 closed 4 years ago

ankitmahapatra22 commented 4 years ago

Describe the bug cdk8s init typescript-app throws file already exists error. OS : Windows 8.1 Node version : 10.11.0

To Reproduce cdk8s init typescript-app

Expected behavior New project should have been created.

Additional context Getting started using https://github.com/awslabs/cdk8s/blob/master/docs/getting-started/typescript.md

cdk8s init issue

stanleynguyen commented 4 years ago

It looks like you were trying to init hello/ and the folder already existed (which explains the OS error)

jmmars commented 4 years ago

No.

(base) ➜ cdk8s git:(master) ✗ cd hello (base) ➜ hello git:(master) ✗ cdk8s init python-app Initializing a project from the python-app template cdk8s init TYPE

Create a new cdk8s project from a template.

Positionals: TYPE Project type [required] [choices: "python-app", "typescript-app"]

Options: --version Show version number [boolean] --help Show help [boolean] --dist Install dependencies from a "dist" directory (for development) [string] --cdk8s-version The cdk8s version to use when creating the new project [string] [default: "0.21.0"]

TypeError: Cannot read property 'mkdir' of undefined at Object.sscaff (/Users/xyz/.npm-global/lib/node_modules/cdk8s-cli/node_modules/sscaff/lib/sscaff.js:18:25) at Object.handler (/Users/xyz/.npm-global/lib/node_modules/cdk8s-cli/bin/cmds/init.js:29:24) at at process._tickCallback (internal/process/next_tick.js:188:7) at Function.Module.runMain (module.js:686:11) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3

This is exactly as described by the docs. To me, there's something wrong w/ init.

campionfellin commented 4 years ago

Hey, could you try with Node 12?

jmmars commented 4 years ago

heh ... hold on..


(base) ➜  hello git:(master) ✗ node --version
v12.16.3
(base) ➜  hello git:(master) ✗ cdk8s init python-app
Initializing a project from the python-app template
Unable to find "pipenv". Install from https://pipenv.kennethreitz.org

I guess need to make sure pipenv is installed?

jmmars commented 4 years ago

So, the solution (update the docs maybe unless I missed these two things in there... ) is to use some version of node >= 12.x (I was using v8.9.4) and to install pipenv (brew install pipenv). So, I take it back, guess my node was crusty.

eladb commented 4 years ago

So, the solution (update the docs maybe unless I missed these two things in there... ) is to use some version of node >= 12.x (I was using v8.9.4) and to install pipenv (brew install pipenv). So, I take it back, guess my node was crusty.

can you submit a PR for doc update?

ankitmahapatra22 commented 4 years ago

Thank you, upgrading the Node version to LTS 12.16.3 helped create the typescript-app templated project successfully. Next I went on to init using python-app template. Similar to @jmmars , I encountered the pipenv installation message. Went on to install pipenv - pip install --user pipenv Followed it up with cdk8s init python-app in a new folder name hello_python Received the error as seen in below screenshot cdk8s_pytho_app_1

Read somewhere that which keyword is not supported in Windows. Switched to using git bash instead.

It failed at the import part cdk8s import k8s -l python cdk8s_python_app_2

Realized it maybe a permission issue , so ran git bash in Administrator mode and now it seems jsii bin folder is missing within cdk8s-cli node_modules folder cdk8s_python_app_3

jmmars commented 4 years ago

can you submit a PR for doc update?

I'll see if I can patch this getting-started/python.md this weekend after looking over your contrib guide. Basically, it just needs to be clearer on prereqs.

Looking forward: At some point, for some systems might be able to do a more programmatic check to make sure base reqs will enable an easy install.

eladb commented 4 years ago

Is this still relevant? Closing for now.