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

Windows Javascript error when running cdktf init --template="python" #194

Closed
afmsavage opened this issue Jul 16, 2020 · 9 comments · Fixed by #270
Closed

Windows Javascript error when running cdktf init --template="python" #194

afmsavage opened this issue Jul 16, 2020 · 9 comments · Fixed by #270
Labels
bug Something isn't working windows

Comments

@afmsavage
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

cdktf & Language Versions

Affected Resource(s)

Debug Output

Expected Behavior

No error.

Actual Behavior

Experienced this error when using the CLI to init my Python project.

Steps to Reproduce

Run cdftf init --template="python"

Important Factoids

References

image

  • #0000
@afmsavage afmsavage added the bug Something isn't working label Jul 16, 2020
@skorfmann
Copy link
Contributor

Likely the same issue as #198

@skorfmann
Copy link
Contributor

Can you confirm the 0.0.12 is fixing your issue?

@afmsavage
Copy link
Author

Nope, still same issue. I am wondering if this has something to do with the fact that my nodejs is installed via scoop and not in default locations? Here is the output of the command.

Another thing to note is that this error is occuring on a completely different one than what I used to first report the issue.

During the bootstrap process, I answered 'no' to having the state stored in TFcloud and then kept the defaults for the name/description of the project.

=>  cdk-tf cdktf init --template="python"
Welcome to CDK for Terraform!

By default, cdktf allows you to manage the state of your stacks using Terraform Cloud for free.
cdktf will request an API token for app.terraform.io using your browser.

If login is successful, cdktf will store the token in plain text in
the following file for use by subsequent Terraform commands:
    C:\Users\afmsa/.terraform.d/credentials.tfrc.json

Note: The local storage mode isn't recommended for storing the state of your stacks.

Do you want to continue with Terraform Cloud remote state management (yes/no)? no

We will now setup the project. Please enter the details for your project.
If you want to exit, press ^C.

Project Name: (default: 'cdk-tf')
Project Description: (default: 'A simple getting started project for cdktf.')
Creating a virtualenv for this project…
Pipfile: C:\dev\sandbox\cdk-tf\Pipfile
Using C:/Users/afmsa/.pyenv/pyenv-win/versions/3.7.5-amd64/python.exe (3.7.5) to create virtualenv…
[   =] Creating virtual environment...created virtual environment in 1921ms CPython3Windows(dest=C:\Users\afmsa\.virtualenvs\cdk-tf-8B0o9F6O, clear=False, global=False) with seeder FromAppData pip=latest setuptools=latest wheel=latest app_data_dir=C:\Users\afmsa\AppData\Local\pypa\virtualenv\seed-v1 via=copy
[  ==]
Successfully created virtual environment!
Virtualenv location: C:\Users\afmsa\.virtualenvs\cdk-tf-8B0o9F6O
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (a65489)!
Installing dependencies from Pipfile.lock (a65489)…
  ================================ 0/0 - 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Installing cdktf~=0.0.12…
Adding cdktf to Pipfile's [packages]…
Installation Succeeded
Pipfile.lock (9c9bdd) out of date, updating to (a65489)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Success!
Updated Pipfile.lock (9c9bdd)!
Installing dependencies from Pipfile.lock (9c9bdd)…
  ================================ 9/9 - 00:00:06
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
cdktf init [OPTIONS]

Create a new cdktf project from a template.

Options:
  --version              Show version number                                                                   [boolean]  --disable-logging      Dont write log files. Supported using the env CDKTF_DISABLE_LOGGING.  [boolean] [default: true]  --log-level            Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL  [string]  --template             The template name to be used to create a new project.[string] [choices: "python", "typescript"]  --project-name         The name of the project.                                                               [string]  --project-description  The description of the project.                                                        [string]  --dist                 Install dependencies from a "dist" directory (for development)                         [string]  --local                Use local state storage for generated Terraform.                     [boolean] [default: false]  --cdktf-version        The cdktf version to use while creating a new project.             [string] [default: "0.0.12"]  -h, --help             Show help                                                                             [boolean]
Error: Command failed: C:\Users\afmsa\scoop\persist\nodejs\bin\node_modules\cdktf-cli\bin\cdktf get
    at checkExecSyncError (child_process.js:616:11)
    at execSync (child_process.js:652:15)
    at Object.exports.post (C:\Users\afmsa\scoop\persist\nodejs\bin\node_modules\cdktf-cli\templates\python\.hooks.sscaff.js:32:3)
    at executePostHook (C:\Users\afmsa\scoop\persist\nodejs\bin\node_modules\cdktf-cli\node_modules\sscaff\lib\sscaff.js:61:37)
    at Object.sscaff (C:\Users\afmsa\scoop\persist\nodejs\bin\node_modules\cdktf-cli\node_modules\sscaff\lib\sscaff.js:28:15)
    at async Object.handler (C:\Users\afmsa\scoop\persist\nodejs\bin\node_modules\cdktf-cli\bin\cmds\init.js:89:9) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 1748,
  stdout: null,
  stderr: null
}

image
image

@skorfmann
Copy link
Contributor

Nope, still same issue. I am wondering if this has something to do with the fact that my nodejs is installed via scoop and not in default locations? Here is the output of the command.

Hm, which node version are you using?

@jsteinich
Copy link
Collaborator

I'm actually getting the exact same error using a build from master. I'll try to troubleshoot further.

@jsteinich
Copy link
Collaborator

This SO issue explains what I believe is happening, although I believe everything is set correctly.

I was trying to run directly without an npm install to generate the wrapper, so my error was probably a bit different.

@jsteinich
Copy link
Collaborator

After working around #268 I am not at the same point and see the issue.

@skorfmann
Copy link
Contributor

Thanks for looking into it @jsteinich

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2022

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants